I have the following method from a library:
IRuleBuilderOptions<T1, T2> MustAsync<T1, T2>(this IRuleBuilder<T1, T2> ruleBuilder, Func<T2, CancellationToken, Task<bool>> predicate);
And I use it as follows:
.MustAsync((t2, token) => someAsyncMethodThatReturnsTaskBoolean());
But I am not able to negate the method as so:
.MustAsync((t2, token) => !someAsyncMethodThatReturnsTaskBoolean());
Because I get the error:
Operator "!" cannot be applied to operand of type Task<bool>
I cannot change the method because it is from an external library.
How can I solve this?