@@ -14,17 +14,10 @@ public static partial class GuardClauseExtensions
14
14
/// <param name="message">Optional. Custom error message</param>
15
15
/// <returns><paramref name="input" /> if the value is not negative.</returns>
16
16
/// <exception cref="ArgumentException"></exception>
17
- #if NETFRAMEWORK || NETSTANDARD2_0
18
- public static int Negative ( this IGuardClause guardClause ,
19
- int input ,
20
- string parameterName ,
21
- string ? message = null )
22
- #else
23
17
public static int Negative ( this IGuardClause guardClause ,
24
18
int input ,
25
19
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
26
20
string ? message = null )
27
- #endif
28
21
{
29
22
return Negative < int > ( guardClause , input , parameterName , message ) ;
30
23
}
@@ -38,17 +31,10 @@ public static int Negative(this IGuardClause guardClause,
38
31
/// <param name="message">Optional. Custom error message</param>
39
32
/// <returns><paramref name="input" /> if the value is not negative.</returns>
40
33
/// <exception cref="ArgumentException"></exception>
41
- #if NETFRAMEWORK || NETSTANDARD2_0
42
- public static long Negative ( this IGuardClause guardClause ,
43
- long input ,
44
- string parameterName ,
45
- string ? message = null )
46
- #else
47
34
public static long Negative ( this IGuardClause guardClause ,
48
35
long input ,
49
36
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
50
37
string ? message = null )
51
- #endif
52
38
{
53
39
return Negative < long > ( guardClause , input , parameterName , message ) ;
54
40
}
@@ -62,17 +48,10 @@ public static long Negative(this IGuardClause guardClause,
62
48
/// <param name="message">Optional. Custom error message</param>
63
49
/// <returns><paramref name="input" /> if the value is not negative.</returns>
64
50
/// <exception cref="ArgumentException"></exception>
65
- #if NETFRAMEWORK || NETSTANDARD2_0
66
- public static decimal Negative ( this IGuardClause guardClause ,
67
- decimal input ,
68
- string parameterName ,
69
- string ? message = null )
70
- #else
71
51
public static decimal Negative ( this IGuardClause guardClause ,
72
52
decimal input ,
73
53
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
74
54
string ? message = null )
75
- #endif
76
55
{
77
56
return Negative < decimal > ( guardClause , input , parameterName , message ) ;
78
57
}
@@ -86,17 +65,10 @@ public static decimal Negative(this IGuardClause guardClause,
86
65
/// <param name="message">Optional. Custom error message</param>
87
66
/// <returns><paramref name="input" /> if the value is not negative.</returns>
88
67
/// <exception cref="ArgumentException"></exception>
89
- #if NETFRAMEWORK || NETSTANDARD2_0
90
- public static float Negative ( IGuardClause guardClause ,
91
- float input ,
92
- string parameterName ,
93
- string ? message = null )
94
- #else
95
68
public static float Negative ( this IGuardClause guardClause ,
96
69
float input ,
97
70
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
98
71
string ? message = null )
99
- #endif
100
72
{
101
73
return Negative < float > ( guardClause , input , parameterName , message ) ;
102
74
}
@@ -110,17 +82,10 @@ public static float Negative(this IGuardClause guardClause,
110
82
/// <param name="message">Optional. Custom error message</param>
111
83
/// <returns><paramref name="input" /> if the value is not negative.</returns>
112
84
/// <exception cref="ArgumentException"></exception>
113
- #if NETFRAMEWORK || NETSTANDARD2_0
114
- public static double Negative ( this IGuardClause guardClause ,
115
- double input ,
116
- string parameterName ,
117
- string ? message = null )
118
- #else
119
85
public static double Negative ( this IGuardClause guardClause ,
120
86
double input ,
121
87
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
122
88
string ? message = null )
123
- #endif
124
89
{
125
90
return Negative < double > ( guardClause , input , parameterName , message ) ;
126
91
}
@@ -134,17 +99,10 @@ public static double Negative(this IGuardClause guardClause,
134
99
/// <param name="message">Optional. Custom error message</param>
135
100
/// <returns><paramref name="input" /> if the value is not negative.</returns>
136
101
/// <exception cref="ArgumentException"></exception>
137
- #if NETFRAMEWORK || NETSTANDARD2_0
138
- public static TimeSpan Negative ( this IGuardClause guardClause ,
139
- TimeSpan input ,
140
- string parameterName ,
141
- string ? message = null )
142
- #else
143
102
public static TimeSpan Negative ( this IGuardClause guardClause ,
144
103
TimeSpan input ,
145
104
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
146
105
string ? message = null )
147
- #endif
148
106
{
149
107
return Negative < TimeSpan > ( guardClause , input , parameterName , message ) ;
150
108
}
@@ -158,17 +116,10 @@ public static TimeSpan Negative(this IGuardClause guardClause,
158
116
/// <param name="message">Optional. Custom error message</param>
159
117
/// <returns><paramref name="input" /> if the value is not negative.</returns>
160
118
/// <exception cref="ArgumentException"></exception>
161
- #if NETFRAMEWORK || NETSTANDARD2_0
162
- private static T Negative < T > ( this IGuardClause guardClause ,
163
- T input ,
164
- string parameterName ,
165
- string ? message = null ) where T : struct , IComparable
166
- #else
167
119
private static T Negative < T > ( this IGuardClause guardClause ,
168
120
T input ,
169
121
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
170
122
string ? message = null ) where T : struct , IComparable
171
- #endif
172
123
{
173
124
if ( input . CompareTo ( default ( T ) ) < 0 )
174
125
{
@@ -186,17 +137,10 @@ private static T Negative<T>(this IGuardClause guardClause,
186
137
/// <param name="parameterName"></param>
187
138
/// <param name="message">Optional. Custom error message</param>
188
139
/// <returns><paramref name="input" /> if the value is not negative or zero.</returns>
189
- #if NETFRAMEWORK || NETSTANDARD2_0
190
- public static int NegativeOrZero ( this IGuardClause guardClause ,
191
- int input ,
192
- string parameterName ,
193
- string ? message = null )
194
- #else
195
140
public static int NegativeOrZero ( this IGuardClause guardClause ,
196
141
int input ,
197
142
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
198
143
string ? message = null )
199
- #endif
200
144
{
201
145
return NegativeOrZero < int > ( guardClause , input , parameterName , message ) ;
202
146
}
@@ -209,17 +153,10 @@ public static int NegativeOrZero(this IGuardClause guardClause,
209
153
/// <param name="parameterName"></param>
210
154
/// <param name="message">Optional. Custom error message</param>
211
155
/// <returns><paramref name="input" /> if the value is not negative or zero.</returns>
212
- #if NETFRAMEWORK || NETSTANDARD2_0
213
- public static long NegativeOrZero ( this IGuardClause guardClause ,
214
- long input ,
215
- string parameterName ,
216
- string ? message = null )
217
- #else
218
156
public static long NegativeOrZero ( this IGuardClause guardClause ,
219
157
long input ,
220
158
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
221
159
string ? message = null )
222
- #endif
223
160
{
224
161
return NegativeOrZero < long > ( guardClause , input , parameterName , message ) ;
225
162
}
@@ -232,17 +169,10 @@ public static long NegativeOrZero(this IGuardClause guardClause,
232
169
/// <param name="parameterName"></param>
233
170
/// <param name="message">Optional. Custom error message</param>
234
171
/// <returns><paramref name="input" /> if the value is not negative or zero.</returns>
235
- #if NETFRAMEWORK || NETSTANDARD2_0
236
- public static decimal NegativeOrZero ( this IGuardClause guardClause ,
237
- decimal input ,
238
- string parameterName ,
239
- string ? message = null )
240
- #else
241
172
public static decimal NegativeOrZero ( this IGuardClause guardClause ,
242
173
decimal input ,
243
174
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
244
175
string ? message = null )
245
- #endif
246
176
{
247
177
return NegativeOrZero < decimal > ( guardClause , input , parameterName , message ) ;
248
178
}
@@ -255,17 +185,10 @@ public static decimal NegativeOrZero(this IGuardClause guardClause,
255
185
/// <param name="parameterName"></param>
256
186
/// <param name="message">Optional. Custom error message</param>
257
187
/// <returns><paramref name="input" /> if the value is not negative or zero.</returns>
258
- #if NETFRAMEWORK || NETSTANDARD2_0
259
- public static float NegativeOrZero ( this IGuardClause guardClause ,
260
- float input ,
261
- string parameterName ,
262
- string ? message = null )
263
- #else
264
188
public static float NegativeOrZero ( this IGuardClause guardClause ,
265
189
float input ,
266
190
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
267
191
string ? message = null )
268
- #endif
269
192
{
270
193
return NegativeOrZero < float > ( guardClause , input , parameterName , message ) ;
271
194
}
@@ -278,17 +201,10 @@ public static float NegativeOrZero(this IGuardClause guardClause,
278
201
/// <param name="parameterName"></param>
279
202
/// <param name="message">Optional. Custom error message</param>
280
203
/// <returns><paramref name="input" /> if the value is not negative or zero.</returns>
281
- #if NETFRAMEWORK || NETSTANDARD2_0
282
- public static double NegativeOrZero ( this IGuardClause guardClause ,
283
- double input ,
284
- string parameterName ,
285
- string ? message = null )
286
- #else
287
204
public static double NegativeOrZero ( this IGuardClause guardClause ,
288
205
double input ,
289
206
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
290
207
string ? message = null )
291
- #endif
292
208
{
293
209
return NegativeOrZero < double > ( guardClause , input , parameterName , message ) ;
294
210
}
@@ -301,17 +217,10 @@ public static double NegativeOrZero(this IGuardClause guardClause,
301
217
/// <param name="parameterName"></param>
302
218
/// <param name="message">Optional. Custom error message</param>
303
219
/// <returns><paramref name="input" /> if the value is not negative or zero.</returns>
304
- #if NETFRAMEWORK || NETSTANDARD2_0
305
- public static TimeSpan NegativeOrZero ( this IGuardClause guardClause ,
306
- TimeSpan input ,
307
- string parameterName ,
308
- string ? message = null )
309
- #else
310
220
public static TimeSpan NegativeOrZero ( this IGuardClause guardClause ,
311
221
TimeSpan input ,
312
222
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
313
223
string ? message = null )
314
- #endif
315
224
{
316
225
return NegativeOrZero < TimeSpan > ( guardClause , input , parameterName , message ) ;
317
226
}
@@ -325,17 +234,10 @@ public static TimeSpan NegativeOrZero(this IGuardClause guardClause,
325
234
/// <param name="parameterName"></param>
326
235
/// <param name="message">Optional. Custom error message</param>
327
236
/// <returns><paramref name="input" /> if the value is not negative or zero.</returns>
328
- #if NETFRAMEWORK || NETSTANDARD2_0
329
- private static T NegativeOrZero < T > ( this IGuardClause guardClause ,
330
- T input ,
331
- string parameterName ,
332
- string ? message = null ) where T : struct , IComparable
333
- #else
334
237
private static T NegativeOrZero < T > ( this IGuardClause guardClause ,
335
238
T input ,
336
239
[ CallerArgumentExpression ( "input" ) ] string ? parameterName = null ,
337
240
string ? message = null ) where T : struct , IComparable
338
- #endif
339
241
{
340
242
if ( input . CompareTo ( default ( T ) ) <= 0 )
341
243
{
0 commit comments