Skip to content

Commit 4cdc1ba

Browse files
committed
nameof
1 parent ba568cf commit 4cdc1ba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

UnitsNet/Comparison.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static class Comparison
5252
public static bool Equals(double referenceValue, double otherValue, double tolerance, ComparisonType comparisonType)
5353
{
5454
if (tolerance < 0)
55-
throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0");
55+
throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0");
5656

5757
switch (comparisonType)
5858
{
@@ -107,7 +107,7 @@ public static bool Equals(double referenceValue, double otherValue, double toler
107107
public static bool Equals(decimal referenceValue, decimal otherValue, decimal tolerance, ComparisonType comparisonType)
108108
{
109109
if (tolerance < 0)
110-
throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0");
110+
throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0");
111111

112112
switch (comparisonType)
113113
{
@@ -144,7 +144,7 @@ public static bool Equals(decimal referenceValue, decimal otherValue, decimal to
144144
public static bool EqualsRelative(double referenceValue, double otherValue, double tolerance)
145145
{
146146
if (tolerance < 0)
147-
throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0");
147+
throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0");
148148

149149
var maxVariation = Math.Abs(referenceValue * tolerance);
150150
return Math.Abs(referenceValue - otherValue) <= maxVariation;
@@ -174,7 +174,7 @@ public static bool EqualsRelative(double referenceValue, double otherValue, doub
174174
public static bool EqualsRelative(decimal referenceValue, decimal otherValue, decimal tolerance)
175175
{
176176
if (tolerance < 0)
177-
throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0");
177+
throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0");
178178

179179
var maxVariation = Math.Abs(referenceValue * tolerance);
180180
return Math.Abs(referenceValue - otherValue) <= maxVariation;
@@ -202,7 +202,7 @@ public static bool EqualsRelative(decimal referenceValue, decimal otherValue, de
202202
public static bool EqualsAbsolute(double value1, double value2, double tolerance)
203203
{
204204
if (tolerance < 0)
205-
throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0");
205+
throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0");
206206

207207
return Math.Abs(value1 - value2) <= tolerance;
208208
}
@@ -229,7 +229,7 @@ public static bool EqualsAbsolute(double value1, double value2, double tolerance
229229
public static bool EqualsAbsolute(decimal value1, decimal value2, decimal tolerance)
230230
{
231231
if (tolerance < 0)
232-
throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0");
232+
throw new ArgumentOutOfRangeException(nameof(tolerance), "Tolerance must be greater than or equal to 0");
233233

234234
return Math.Abs(value1 - value2) <= tolerance;
235235
}

0 commit comments

Comments
 (0)