diff --git a/src/GuardClauses/GuardAgainstExpressionExtensionsDeprecated.cs b/src/GuardClauses/GuardAgainstExpressionExtensionsDeprecated.cs index 3f0ca0c..a8c0b32 100644 --- a/src/GuardClauses/GuardAgainstExpressionExtensionsDeprecated.cs +++ b/src/GuardClauses/GuardAgainstExpressionExtensionsDeprecated.cs @@ -15,16 +15,13 @@ public static partial class GuardClauseExtensions /// /// if the evaluates to true /// - [Obsolete("Deprecated: Switch to Expression for validation.")] + [Obsolete("Deprecated: Switch to Expression for validation (and reverse logic).")] public static T AgainstExpression(this IGuardClause guardClause, Func func, T input, string message) where T : struct { - if (!func(input)) - { - throw new ArgumentException(message); - } + if (!func(input)) throw new ArgumentException(message); return input; } @@ -39,16 +36,13 @@ public static T AgainstExpression(this IGuardClause guardClause, /// /// if the evaluates to true /// - [Obsolete("Deprecated: Switch to ExpressionAsync for asynchronous validation.")] + [Obsolete("Deprecated: Switch to ExpressionAsync for asynchronous validation (and reverse logic).")] public static async Task AgainstExpressionAsync(this IGuardClause guardClause, Func> func, T input, string message) where T : struct { - if (!await func(input)) - { - throw new ArgumentException(message); - } + if (!await func(input)) throw new ArgumentException(message); return input; } @@ -64,14 +58,11 @@ public static async Task AgainstExpressionAsync(this IGuardClause guardCla /// The name of the parameter that is invalid /// if the evaluates to true /// - [Obsolete("Deprecated: Switch to Expression for validation.")] + [Obsolete("Deprecated: Switch to Expression for validation (and reverse logic).")] public static T AgainstExpression(this IGuardClause guardClause, Func func, T input, string message, string paramName) where T : struct { - if (!func(input)) - { - throw new ArgumentException(message, paramName); - } + if (!func(input)) throw new ArgumentException(message, paramName); return input; }