Method AnyAsync
AnyAsync<TSource>(IMongoQueryable<TSource>, CancellationToken)
Determines whether a sequence contains any elements.
public static Task<bool> AnyAsync<TSource>(this IMongoQueryable<TSource> source, CancellationToken cancellationToken = default)
Parameters
sourceIMongoQueryable<TSource>A sequence to check for being empty.
cancellationTokenCancellationTokenThe cancellation token.
Returns
Type Parameters
TSourceThe type of the elements of
source.
AnyAsync<TSource>(IMongoQueryable<TSource>, Expression<Func<TSource, bool>>, CancellationToken)
Determines whether any element of a sequence satisfies a condition.
public static Task<bool> AnyAsync<TSource>(this IMongoQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken = default)
Parameters
sourceIMongoQueryable<TSource>A sequence whose elements to test for a condition.
predicateExpression<Func<TSource, bool>>A function to test each element for a condition.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<bool>
true if any elements in the source sequence pass the test in the specified predicate; otherwise, false.
Type Parameters
TSourceThe type of the elements of
source.