You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing Compare methods to compare current value to other in "this" … (#454)
* Changing Compare methods to compare current value to other in "this" units. This avoids scaling issues (and converting two quantities when we only need to potentially convert one) when both "this" and "other" are not defined in base units. "This" is the reference value.
* Use nameof(param) for parameter exceptions
if(!(objisAcceleration))thrownewArgumentException("Expected type Acceleration.",nameof(obj));
741
+
742
+
returnCompareTo((Acceleration)obj);
742
743
}
743
744
744
745
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -749,7 +750,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -1006,7 +1007,7 @@ public static Acceleration Parse(
1006
1007
[CanBeNull]IFormatProviderprovider)
1007
1008
#endif
1008
1009
{
1009
-
if(str==null) throw new ArgumentNullException("str");
1010
+
if(str==null) throw new ArgumentNullException(nameof(str));
1010
1011
1011
1012
#if WINDOWS_UWP
1012
1013
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisAmountOfSubstance))thrownewArgumentException("Expected type AmountOfSubstance.",nameof(obj));
774
+
775
+
returnCompareTo((AmountOfSubstance)obj);
775
776
}
776
777
777
778
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -782,7 +783,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -1041,7 +1042,7 @@ public static AmountOfSubstance Parse(
1041
1042
[CanBeNull]IFormatProviderprovider)
1042
1043
#endif
1043
1044
{
1044
-
if(str==null) throw new ArgumentNullException("str");
1045
+
if(str==null) throw new ArgumentNullException(nameof(str));
1045
1046
1046
1047
#if WINDOWS_UWP
1047
1048
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisAmplitudeRatio))thrownewArgumentException("Expected type AmplitudeRatio.",nameof(obj));
442
+
443
+
returnCompareTo((AmplitudeRatio)obj);
443
444
}
444
445
445
446
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -450,7 +451,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -689,7 +690,7 @@ public static AmplitudeRatio Parse(
689
690
[CanBeNull]IFormatProviderprovider)
690
691
#endif
691
692
{
692
-
if(str==null) throw new ArgumentNullException("str");
693
+
if(str==null) throw new ArgumentNullException(nameof(str));
693
694
694
695
#if WINDOWS_UWP
695
696
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisAngle))thrownewArgumentException("Expected type Angle.",nameof(obj));
764
+
765
+
returnCompareTo((Angle)obj);
765
766
}
766
767
767
768
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -772,7 +773,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -1031,7 +1032,7 @@ public static Angle Parse(
1031
1032
[CanBeNull]IFormatProviderprovider)
1032
1033
#endif
1033
1034
{
1034
-
if(str==null) throw new ArgumentNullException("str");
1035
+
if(str==null) throw new ArgumentNullException(nameof(str));
1035
1036
1036
1037
#if WINDOWS_UWP
1037
1038
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisApparentEnergy))thrownewArgumentException("Expected type ApparentEnergy.",nameof(obj));
411
+
412
+
returnCompareTo((ApparentEnergy)obj);
412
413
}
413
414
414
415
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -419,7 +420,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -656,7 +657,7 @@ public static ApparentEnergy Parse(
656
657
[CanBeNull]IFormatProviderprovider)
657
658
#endif
658
659
{
659
-
if(str==null) throw new ArgumentNullException("str");
660
+
if(str==null) throw new ArgumentNullException(nameof(str));
660
661
661
662
#if WINDOWS_UWP
662
663
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisApparentPower))thrownewArgumentException("Expected type ApparentPower.",nameof(obj));
444
+
445
+
returnCompareTo((ApparentPower)obj);
445
446
}
446
447
447
448
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -452,7 +453,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -691,7 +692,7 @@ public static ApparentPower Parse(
691
692
[CanBeNull]IFormatProviderprovider)
692
693
#endif
693
694
{
694
-
if(str==null) throw new ArgumentNullException("str");
695
+
if(str==null) throw new ArgumentNullException(nameof(str));
695
696
696
697
#if WINDOWS_UWP
697
698
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisArea))thrownewArgumentException("Expected type Area.",nameof(obj));
741
+
742
+
returnCompareTo((Area)obj);
742
743
}
743
744
744
745
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -749,7 +750,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -1006,7 +1007,7 @@ public static Area Parse(
1006
1007
[CanBeNull]IFormatProviderprovider)
1007
1008
#endif
1008
1009
{
1009
-
if(str==null) throw new ArgumentNullException("str");
1010
+
if(str==null) throw new ArgumentNullException(nameof(str));
1010
1011
1011
1012
#if WINDOWS_UWP
1012
1013
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisAreaDensity))thrownewArgumentException("Expected type AreaDensity.",nameof(obj));
345
+
346
+
returnCompareTo((AreaDensity)obj);
346
347
}
347
348
348
349
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -353,7 +354,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -586,7 +587,7 @@ public static AreaDensity Parse(
586
587
[CanBeNull]IFormatProviderprovider)
587
588
#endif
588
589
{
589
-
if(str==null) throw new ArgumentNullException("str");
590
+
if(str==null) throw new ArgumentNullException(nameof(str));
590
591
591
592
#if WINDOWS_UWP
592
593
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
if(!(objisAreaMomentOfInertia))thrownewArgumentException("Expected type AreaMomentOfInertia.",nameof(obj));
510
+
511
+
returnCompareTo((AreaMomentOfInertia)obj);
511
512
}
512
513
513
514
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
@@ -518,7 +519,7 @@ public int CompareTo(object obj)
// Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -761,7 +762,7 @@ public static AreaMomentOfInertia Parse(
761
762
[CanBeNull]IFormatProviderprovider)
762
763
#endif
763
764
{
764
-
if(str==null) throw new ArgumentNullException("str");
765
+
if(str==null) throw new ArgumentNullException(nameof(str));
765
766
766
767
#if WINDOWS_UWP
767
768
// Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
@@ -889,7 +890,7 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string c
0 commit comments