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
source
IMongoQueryable<TSource>A sequence to check for being empty.
cancellationToken
CancellationTokenThe cancellation token.
Returns
Type Parameters
TSource
The 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
source
IMongoQueryable<TSource>A sequence whose elements to test for a condition.
predicate
Expression<Func<TSource, bool>>A function to test each element for a condition.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<bool>
true if any elements in the source sequence pass the test in the specified predicate; otherwise, false.
Type Parameters
TSource
The type of the elements of
source
.