@@ -96,39 +96,39 @@ public override string Message
96
96
public virtual object ? ActualValue => _actualValue ;
97
97
98
98
[ DoesNotReturn ]
99
- private static void ThrowZero < T > ( string ? paramName , T value ) =>
99
+ private static void ThrowZero < T > ( T value , string ? paramName ) =>
100
100
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeNonZero , paramName , value ) ) ;
101
101
102
102
[ DoesNotReturn ]
103
- private static void ThrowNegative < T > ( string ? paramName , T value ) =>
103
+ private static void ThrowNegative < T > ( T value , string ? paramName ) =>
104
104
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeNonNegative , paramName , value ) ) ;
105
105
106
106
[ DoesNotReturn ]
107
- private static void ThrowNegativeOrZero < T > ( string ? paramName , T value ) =>
107
+ private static void ThrowNegativeOrZero < T > ( T value , string ? paramName ) =>
108
108
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeNonNegativeNonZero , paramName , value ) ) ;
109
109
110
110
[ DoesNotReturn ]
111
- private static void ThrowGreater < T > ( string ? paramName , T value , T other ) =>
111
+ private static void ThrowGreater < T > ( T value , T other , string ? paramName ) =>
112
112
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeLessOrEqual , paramName , value , other ) ) ;
113
113
114
114
[ DoesNotReturn ]
115
- private static void ThrowGreaterEqual < T > ( string ? paramName , T value , T other ) =>
115
+ private static void ThrowGreaterEqual < T > ( T value , T other , string ? paramName ) =>
116
116
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeLess , paramName , value , other ) ) ;
117
117
118
118
[ DoesNotReturn ]
119
- private static void ThrowLess < T > ( string ? paramName , T value , T other ) =>
119
+ private static void ThrowLess < T > ( T value , T other , string ? paramName ) =>
120
120
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeGreaterOrEqual , paramName , value , other ) ) ;
121
121
122
122
[ DoesNotReturn ]
123
- private static void ThrowLessEqual < T > ( string ? paramName , T value , T other ) =>
123
+ private static void ThrowLessEqual < T > ( T value , T other , string ? paramName ) =>
124
124
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeGreater , paramName , value , other ) ) ;
125
125
126
126
[ DoesNotReturn ]
127
- private static void ThrowEqual < T > ( string ? paramName , T value , T other ) =>
127
+ private static void ThrowEqual < T > ( T value , T other , string ? paramName ) =>
128
128
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeNotEqual , paramName , ( object ? ) value ?? "null" , ( object ? ) other ?? "null" ) ) ;
129
129
130
130
[ DoesNotReturn ]
131
- private static void ThrowNotEqual < T > ( string ? paramName , T value , T other ) =>
131
+ private static void ThrowNotEqual < T > ( T value , T other , string ? paramName ) =>
132
132
throw new ArgumentOutOfRangeException ( paramName , value , SR . Format ( SR . ArgumentOutOfRange_Generic_MustBeEqual , paramName , ( object ? ) value ?? "null" , ( object ? ) other ?? "null" ) ) ;
133
133
134
134
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is zero.</summary>
@@ -138,7 +138,7 @@ public static void ThrowIfZero<T>(T value, [CallerArgumentExpression(nameof(valu
138
138
where T : INumberBase < T >
139
139
{
140
140
if ( T . IsZero ( value ) )
141
- ThrowZero ( paramName , value ) ;
141
+ ThrowZero ( value , paramName ) ;
142
142
}
143
143
144
144
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is negative.</summary>
@@ -148,7 +148,7 @@ public static void ThrowIfNegative<T>(T value, [CallerArgumentExpression(nameof(
148
148
where T : INumberBase < T >
149
149
{
150
150
if ( T . IsNegative ( value ) )
151
- ThrowNegative ( paramName , value ) ;
151
+ ThrowNegative ( value , paramName ) ;
152
152
}
153
153
154
154
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is negative or zero.</summary>
@@ -158,7 +158,7 @@ public static void ThrowIfNegativeOrZero<T>(T value, [CallerArgumentExpression(n
158
158
where T : INumberBase < T >
159
159
{
160
160
if ( T . IsNegative ( value ) || T . IsZero ( value ) )
161
- ThrowNegativeOrZero ( paramName , value ) ;
161
+ ThrowNegativeOrZero ( value , paramName ) ;
162
162
}
163
163
164
164
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is equal to <paramref name="other"/>.</summary>
@@ -168,7 +168,7 @@ public static void ThrowIfNegativeOrZero<T>(T value, [CallerArgumentExpression(n
168
168
public static void ThrowIfEqual < T > ( T value , T other , [ CallerArgumentExpression ( nameof ( value ) ) ] string ? paramName = null ) where T : IEquatable < T > ?
169
169
{
170
170
if ( EqualityComparer < T > . Default . Equals ( value , other ) )
171
- ThrowEqual ( paramName , value , other ) ;
171
+ ThrowEqual ( value , other , paramName ) ;
172
172
}
173
173
174
174
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is not equal to <paramref name="other"/>.</summary>
@@ -178,7 +178,7 @@ public static void ThrowIfEqual<T>(T value, T other, [CallerArgumentExpression(n
178
178
public static void ThrowIfNotEqual < T > ( T value , T other , [ CallerArgumentExpression ( nameof ( value ) ) ] string ? paramName = null ) where T : IEquatable < T > ?
179
179
{
180
180
if ( ! EqualityComparer < T > . Default . Equals ( value , other ) )
181
- ThrowNotEqual ( paramName , value , other ) ;
181
+ ThrowNotEqual ( value , other , paramName ) ;
182
182
}
183
183
184
184
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is greater than <paramref name="other"/>.</summary>
@@ -189,7 +189,7 @@ public static void ThrowIfGreaterThan<T>(T value, T other, [CallerArgumentExpres
189
189
where T : IComparable < T >
190
190
{
191
191
if ( value . CompareTo ( other ) > 0 )
192
- ThrowGreater ( paramName , value , other ) ;
192
+ ThrowGreater ( value , other , paramName ) ;
193
193
}
194
194
195
195
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is greater than or equal <paramref name="other"/>.</summary>
@@ -200,7 +200,7 @@ public static void ThrowIfGreaterThanOrEqual<T>(T value, T other, [CallerArgumen
200
200
where T : IComparable < T >
201
201
{
202
202
if ( value . CompareTo ( other ) >= 0 )
203
- ThrowGreaterEqual ( paramName , value , other ) ;
203
+ ThrowGreaterEqual ( value , other , paramName ) ;
204
204
}
205
205
206
206
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is less than <paramref name="other"/>.</summary>
@@ -211,7 +211,7 @@ public static void ThrowIfLessThan<T>(T value, T other, [CallerArgumentExpressio
211
211
where T : IComparable < T >
212
212
{
213
213
if ( value . CompareTo ( other ) < 0 )
214
- ThrowLess ( paramName , value , other ) ;
214
+ ThrowLess ( value , other , paramName ) ;
215
215
}
216
216
217
217
/// <summary>Throws an <see cref="ArgumentOutOfRangeException"/> if <paramref name="value"/> is less than or equal <paramref name="other"/>.</summary>
@@ -222,7 +222,7 @@ public static void ThrowIfLessThanOrEqual<T>(T value, T other, [CallerArgumentEx
222
222
where T : IComparable < T >
223
223
{
224
224
if ( value . CompareTo ( other ) <= 0 )
225
- ThrowLessEqual ( paramName , value , other ) ;
225
+ ThrowLessEqual ( value , other , paramName ) ;
226
226
}
227
227
}
228
228
}
0 commit comments