Method AnyAsync
| MongoDB CSharp Driver API Reference (original) (raw)
Namespace
Assembly
MongoDB.Driver.dll
AnyAsync(IQueryable, CancellationToken)
Determines whether a sequence contains any elements.
public static Task<bool> AnyAsync<TSource>(this IQueryable<TSource> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence to check for being empty.
cancellationToken
CancellationToken
The cancellation token.
Returns
true if the source sequence contains any elements; otherwise, false.
Type Parameters
TSource
The type of the elements of source
.
AnyAsync(IQueryable, Expression<Func<TSource, bool>>, CancellationToken)
Determines whether any element of a sequence satisfies a condition.
public static Task<bool> AnyAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence whose elements to test for a condition.
predicate
Expression<Func<TSource, bool>>
A function to test each element for a condition.
cancellationToken
CancellationToken
The cancellation token.
Returns
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
.