QueryableExtensions.AnyAsync Method

Definition

Overloads

AnyAsync<TSource>(IQueryable<TSource>)

Asynchronously determines whether a sequence contains any elements.

AnyAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)

Asynchronously determines whether any element of a sequence satisfies a condition.

AnyAsync<TSource>(IQueryable<TSource>, CancellationToken)

Asynchronously determines whether a sequence contains any elements.

AnyAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

Asynchronously determines whether any element of a sequence satisfies a condition.

AnyAsync<TSource>(IQueryable<TSource>)

Asynchronously determines whether a sequence contains any elements.

public static System.Threading.Tasks.Task<bool> AnyAsync<TSource> (this System.Linq.IQueryable<TSource> source);
static member AnyAsync : System.Linq.IQueryable<'Source> -> System.Threading.Tasks.Task<bool>
<Extension()>
Public Function AnyAsync(Of TSource) (source As IQueryable(Of TSource)) As Task(Of Boolean)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> to check for being empty.

Returns

A task that represents the asynchronous operation. The task result contains true if the source sequence contains any elements; otherwise, false.

Exceptions

source is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to

AnyAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>)

Asynchronously determines whether any element of a sequence satisfies a condition.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<bool> AnyAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,bool>> predicate);
static member AnyAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, bool>> -> System.Threading.Tasks.Task<bool>
<Extension()>
Public Function AnyAsync(Of TSource) (source As IQueryable(Of TSource), predicate As Expression(Of Func(Of TSource, Boolean))) As Task(Of Boolean)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> whose elements to test for a condition.

predicate
Expression<Func<TSource,Boolean>>

A function to test each element for a condition.

Returns

A task that represents the asynchronous operation. The task result contains true if any elements in the source sequence pass the test in the specified predicate; otherwise, false.

Attributes

Exceptions

source or predicate is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to

AnyAsync<TSource>(IQueryable<TSource>, CancellationToken)

Asynchronously determines whether a sequence contains any elements.

public static System.Threading.Tasks.Task<bool> AnyAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Threading.CancellationToken cancellationToken);
static member AnyAsync : System.Linq.IQueryable<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> to check for being empty.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A task that represents the asynchronous operation. The task result contains true if the source sequence contains any elements; otherwise, false.

Exceptions

source is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to

AnyAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

Asynchronously determines whether any element of a sequence satisfies a condition.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<bool> AnyAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,bool>> predicate, System.Threading.CancellationToken cancellationToken);
static member AnyAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, bool>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> whose elements to test for a condition.

predicate
Expression<Func<TSource,Boolean>>

A function to test each element for a condition.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A task that represents the asynchronous operation. The task result contains true if any elements in the source sequence pass the test in the specified predicate; otherwise, false.

Attributes

Exceptions

source or predicate is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to