Bewerken

Delen via


AsyncEnumerable.AllAsync Method

Definition

Overloads

AllAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,Boolean>, CancellationToken)

Determines whether all elements of a sequence satisfy a condition.

AllAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<Boolean>>, CancellationToken)

Determines whether all elements of a sequence satisfy a condition.

AllAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,Boolean>, CancellationToken)

Source:
AllAsync.cs

Determines whether all elements of a sequence satisfy a condition.

public static System.Threading.Tasks.ValueTask<bool> AllAsync<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,bool> predicate, System.Threading.CancellationToken cancellationToken = default);
static member AllAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, bool> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<bool>
<Extension()>
Public Function AllAsync(Of TSource) (source As IAsyncEnumerable(Of TSource), predicate As Func(Of TSource, Boolean), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Boolean)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> that contains the elements to apply the predicate to.

predicate
Func<TSource,Boolean>

A function to test each element for a condition.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.

Exceptions

predicate is null.

Applies to

AllAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<Boolean>>, CancellationToken)

Source:
AllAsync.cs

Determines whether all elements of a sequence satisfy a condition.

public static System.Threading.Tasks.ValueTask<bool> AllAsync<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<bool>> predicate, System.Threading.CancellationToken cancellationToken = default);
static member AllAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<bool>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<bool>
<Extension()>
Public Function AllAsync(Of TSource) (source As IAsyncEnumerable(Of TSource), predicate As Func(Of TSource, CancellationToken, ValueTask(Of Boolean)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Boolean)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> that contains the elements to apply the predicate to.

predicate
Func<TSource,CancellationToken,ValueTask<Boolean>>

A function to test each element for a condition.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.

Exceptions

predicate is null.

Applies to