@@ -15,16 +15,13 @@ public static partial class GuardClauseExtensions
1515 /// <param name="message"></param>
1616 /// <returns><paramref name="input"/> if the <paramref name="func"/> evaluates to true </returns>
1717 /// <exception cref="ArgumentException"></exception>
18- [ Obsolete ( "Deprecated: Switch to Expression for validation." ) ]
18+ [ Obsolete ( "Deprecated: Switch to Expression for validation (and reverse logic) ." ) ]
1919 public static T AgainstExpression < T > ( this IGuardClause guardClause ,
2020 Func < T , bool > func ,
2121 T input ,
2222 string message ) where T : struct
2323 {
24- if ( ! func ( input ) )
25- {
26- throw new ArgumentException ( message ) ;
27- }
24+ if ( ! func ( input ) ) throw new ArgumentException ( message ) ;
2825
2926 return input ;
3027 }
@@ -39,16 +36,13 @@ public static T AgainstExpression<T>(this IGuardClause guardClause,
3936 /// <param name="message"></param>
4037 /// <returns><paramref name="input"/> if the <paramref name="func"/> evaluates to true </returns>
4138 /// <exception cref="ArgumentException"></exception>
42- [ Obsolete ( "Deprecated: Switch to ExpressionAsync for asynchronous validation." ) ]
39+ [ Obsolete ( "Deprecated: Switch to ExpressionAsync for asynchronous validation (and reverse logic) ." ) ]
4340 public static async Task < T > AgainstExpressionAsync < T > ( this IGuardClause guardClause ,
4441 Func < T , Task < bool > > func ,
4542 T input ,
4643 string message ) where T : struct
4744 {
48- if ( ! await func ( input ) )
49- {
50- throw new ArgumentException ( message ) ;
51- }
45+ if ( ! await func ( input ) ) throw new ArgumentException ( message ) ;
5246
5347 return input ;
5448 }
@@ -64,14 +58,11 @@ public static async Task<T> AgainstExpressionAsync<T>(this IGuardClause guardCla
6458 /// <param name="paramName">The name of the parameter that is invalid</param>
6559 /// <returns><paramref name="input"/> if the <paramref name="func"/> evaluates to true </returns>
6660 /// <exception cref="ArgumentException"></exception>
67- [ Obsolete ( "Deprecated: Switch to Expression for validation." ) ]
61+ [ Obsolete ( "Deprecated: Switch to Expression for validation (and reverse logic) ." ) ]
6862 public static T AgainstExpression < T > ( this IGuardClause guardClause , Func < T , bool > func ,
6963 T input , string message , string paramName ) where T : struct
7064 {
71- if ( ! func ( input ) )
72- {
73- throw new ArgumentException ( message , paramName ) ;
74- }
65+ if ( ! func ( input ) ) throw new ArgumentException ( message , paramName ) ;
7566
7667 return input ;
7768 }
0 commit comments