Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Task.WhenEach Method

Definition

Namespace:
System.Threading.Tasks
Assemblies:
netstandard.dll, System.Runtime.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

NameDescription
WhenEach(IEnumerable<Task>)

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

WhenEach(ReadOnlySpan<Task>)

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

WhenEach(Task[])

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

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

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

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

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

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

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

WhenEach(IEnumerable<Task>)

Source:
Task.cs

Creates anIAsyncEnumerable<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

AnIAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

WhenEach(ReadOnlySpan<Task>)

Source:
Task.cs

Creates anIAsyncEnumerable<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(scoped 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

AnIAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

WhenEach(Task[])

Source:
Task.cs

Creates anIAsyncEnumerable<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

AnIAsyncEnumerable<T> for iterating through the supplied tasks.

Exceptions

tasks contains anull.

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>>)

Source:
Task.cs

Creates anIAsyncEnumerable<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

AnIAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

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

Source:
Task.cs

Creates anIAsyncEnumerable<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>(scoped 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

AnIAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

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

Source:
Task.cs

Creates anIAsyncEnumerable<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

AnIAsyncEnumerable<T> for iterating through the supplied tasks.

Applies to

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?