แก้ไข

แชร์ผ่าน


Task.WhenEach Method

Definition

Overloads

WhenEach(IEnumerable<Task>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

WhenEach(ReadOnlySpan<Task>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

WhenEach(Task[])

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

WhenEach<TResult>(IEnumerable<Task<TResult>>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

WhenEach<TResult>(ReadOnlySpan<Task<TResult>>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

WhenEach<TResult>(Task<TResult>[])

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

WhenEach(IEnumerable<Task>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

public:
 static System::Collections::Generic::IAsyncEnumerable<System::Threading::Tasks::Task ^> ^ WhenEach(System::Collections::Generic::IEnumerable<System::Threading::Tasks::Task ^> ^ tasks);
public static System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task> WhenEach (System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> tasks);
static member WhenEach : seq<System.Threading.Tasks.Task> -> System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task>
Public Shared Function WhenEach (tasks As IEnumerable(Of Task)) As IAsyncEnumerable(Of Task)

Parameters

tasks
IEnumerable<Task>

The tasks to iterate through as they complete.

Returns

An IAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

WhenEach(ReadOnlySpan<Task>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

public:
 static System::Collections::Generic::IAsyncEnumerable<System::Threading::Tasks::Task ^> ^ WhenEach(ReadOnlySpan<System::Threading::Tasks::Task ^> tasks);
public static System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task> WhenEach (ReadOnlySpan<System.Threading.Tasks.Task> tasks);
static member WhenEach : ReadOnlySpan<System.Threading.Tasks.Task> -> System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task>
Public Shared Function WhenEach (tasks As ReadOnlySpan(Of Task)) As IAsyncEnumerable(Of Task)

Parameters

tasks
ReadOnlySpan<Task>

The tasks to iterate through as they complete.

Returns

An IAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

WhenEach(Task[])

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

public:
 static System::Collections::Generic::IAsyncEnumerable<System::Threading::Tasks::Task ^> ^ WhenEach(... cli::array <System::Threading::Tasks::Task ^> ^ tasks);
public static System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task> WhenEach (params System.Threading.Tasks.Task[] tasks);
static member WhenEach : System.Threading.Tasks.Task[] -> System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task>
Public Shared Function WhenEach (ParamArray tasks As Task()) As IAsyncEnumerable(Of Task)

Parameters

tasks
Task[]

The task to iterate through when completed.

Returns

An IAsyncEnumerable<T> for iterating through the supplied tasks.

Exceptions

tasks is null.

tasks contains a null.

Remarks

The supplied tasks will become available to be output via the enumerable once they've completed. The exact order in which the tasks will become available is not defined.

Applies to

WhenEach<TResult>(IEnumerable<Task<TResult>>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

public:
generic <typename TResult>
 static System::Collections::Generic::IAsyncEnumerable<System::Threading::Tasks::Task<TResult> ^> ^ WhenEach(System::Collections::Generic::IEnumerable<System::Threading::Tasks::Task<TResult> ^> ^ tasks);
public static System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task<TResult>> WhenEach<TResult> (System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<TResult>> tasks);
static member WhenEach : seq<System.Threading.Tasks.Task<'Result>> -> System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task<'Result>>
Public Shared Function WhenEach(Of TResult) (tasks As IEnumerable(Of Task(Of TResult))) As IAsyncEnumerable(Of Task(Of TResult))

Type Parameters

TResult

The type of the result returned by the tasks.

Parameters

tasks
IEnumerable<Task<TResult>>

The tasks to iterate through as they complete.

Returns

An IAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

WhenEach<TResult>(ReadOnlySpan<Task<TResult>>)

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

public:
generic <typename TResult>
 static System::Collections::Generic::IAsyncEnumerable<System::Threading::Tasks::Task<TResult> ^> ^ WhenEach(ReadOnlySpan<System::Threading::Tasks::Task<TResult> ^> tasks);
public static System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task<TResult>> WhenEach<TResult> (ReadOnlySpan<System.Threading.Tasks.Task<TResult>> tasks);
static member WhenEach : ReadOnlySpan<System.Threading.Tasks.Task<'Result>> -> System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task<'Result>>
Public Shared Function WhenEach(Of TResult) (tasks As ReadOnlySpan(Of Task(Of TResult))) As IAsyncEnumerable(Of Task(Of TResult))

Type Parameters

TResult

The type of the result returned by the tasks.

Parameters

tasks
ReadOnlySpan<Task<TResult>>

The tasks to iterate through as they complete.

Returns

An IAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

WhenEach<TResult>(Task<TResult>[])

Creates an IAsyncEnumerable<T> that will yield the supplied tasks as those tasks complete.

public:
generic <typename TResult>
 static System::Collections::Generic::IAsyncEnumerable<System::Threading::Tasks::Task<TResult> ^> ^ WhenEach(... cli::array <System::Threading::Tasks::Task<TResult> ^> ^ tasks);
public static System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task<TResult>> WhenEach<TResult> (params System.Threading.Tasks.Task<TResult>[] tasks);
static member WhenEach : System.Threading.Tasks.Task<'Result>[] -> System.Collections.Generic.IAsyncEnumerable<System.Threading.Tasks.Task<'Result>>
Public Shared Function WhenEach(Of TResult) (ParamArray tasks As Task(Of TResult)()) As IAsyncEnumerable(Of Task(Of TResult))

Type Parameters

TResult

The type of the result returned by the tasks.

Parameters

tasks
Task<TResult>[]

The tasks to iterate through as they complete.

Returns

An IAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to