Task.WhenAny 메서드

정의

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

오버로드

WhenAny(IEnumerable<Task>)

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

WhenAny(Task[])

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

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

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

WhenAny<TResult>(IEnumerable<Task<TResult>>)

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

WhenAny(IEnumerable<Task>)

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

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

매개 변수

tasks
IEnumerable<Task>

완료를 기다리는 작업입니다.The tasks to wait on for completion.

반환

제공된 한 작업의 완료를 나타내는 작업입니다.A task that represents the completion of one of the supplied tasks. 반환 작업의 결과는 완료된 작업입니다.The return task's Result is the task that completed.

예외

tasks 인수가 null인 경우The tasks argument was null.

null 작업이 포함되었거나 비어 있는 tasks 배열입니다.The tasks array contained a null task, or was empty.

설명

경우에 반환 된 작업이 완료 됩니다 제공 된 작업을 완료 합니다.The returned task will complete when any of the supplied tasks has completed. 반환 된 작업이 종료 됩니다. 항상를 RanToCompletion 첫 번째 작업을 완료로 설정 하는 해당 결과가 포함 된 상태입니다.The returned task will always end in the RanToCompletion state with its Result set to the first task to complete. 첫 번째 작업이 완료 되기를 인해 종료 된 경우에 마찬가지 합니다 Canceled 또는 Faulted 상태입니다.This is true even if the first task to complete ended in the Canceled or Faulted state.

WhenAny(Task[])

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

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

매개 변수

tasks
Task[]

완료를 기다리는 작업입니다.The tasks to wait on for completion.

반환

제공된 한 작업의 완료를 나타내는 작업입니다.A task that represents the completion of one of the supplied tasks. 반환 작업의 결과는 완료된 작업입니다.The return task's Result is the task that completed.

예외

tasks 인수가 null인 경우The tasks argument was null.

null 작업이 포함되었거나 비어 있는 tasks 배열입니다.The tasks array contained a null task, or was empty.

설명

경우에 반환 된 작업이 완료 됩니다 제공 된 작업을 완료 합니다.The returned task will complete when any of the supplied tasks has completed. 반환 된 작업이 종료 됩니다. 항상을 RanToCompletion 상태 이며 해당 Result 첫 번째 작업을 완료로 설정 합니다.The returned task will always end in the RanToCompletion state with its Result set to the first task to complete. 첫 번째 작업이 완료 되기를 인해 종료 된 경우에 마찬가지 합니다 Canceled 또는 Faulted 상태입니다.This is true even if the first task to complete ended in the Canceled or Faulted state.

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

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

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

형식 매개 변수

TResult

완료된 작업의 형식입니다.The type of the completed task.

매개 변수

tasks
Task<TResult>[]

완료를 기다리는 작업입니다.The tasks to wait on for completion.

반환

Task<Task<TResult>>

제공된 한 작업의 완료를 나타내는 작업입니다.A task that represents the completion of one of the supplied tasks. 반환 작업의 결과는 완료된 작업입니다.The return task's Result is the task that completed.

예외

tasks 인수가 null인 경우The tasks argument was null.

null 작업이 포함되었거나 비어 있는 tasks 배열입니다.The tasks array contained a null task, or was empty.

설명

경우에 반환 된 작업이 완료 됩니다 제공 된 작업을 완료 합니다.The returned task will complete when any of the supplied tasks has completed. 반환된 된 작업 결과 완료 하려면 첫 번째 작업 집합을 사용 하 여 RanToCompletion 상태의 항상 종료 됩니다.The returned task will always end in the RanToCompletion state with its Result set to the first task to complete. 첫 번째 작업이 완료 되기를 Canceled 또는 Faulted 상태에서 종료 하는 경우에 마찬가지입니다.This is true even if the first task to complete ended in the Canceled or Faulted state.

WhenAny<TResult>(IEnumerable<Task<TResult>>)

제공된 작업을 모두 완료했을 때 완료할 작업을 만듭니다.Creates a task that will complete when any of the supplied tasks have completed.

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

형식 매개 변수

TResult

완료된 작업의 형식입니다.The type of the completed task.

매개 변수

tasks
IEnumerable<Task<TResult>>

완료를 기다리는 작업입니다.The tasks to wait on for completion.

반환

Task<Task<TResult>>

제공된 한 작업의 완료를 나타내는 작업입니다.A task that represents the completion of one of the supplied tasks. 반환 작업의 결과는 완료된 작업입니다.The return task's Result is the task that completed.

예외

tasks 인수가 null인 경우The tasks argument was null.

null 작업이 포함되었거나 비어 있는 tasks 배열입니다.The tasks array contained a null task, or was empty.

설명

경우에 반환 된 작업이 완료 됩니다 제공 된 작업을 완료 합니다.The returned task will complete when any of the supplied tasks has completed. 반환된 된 작업 결과 완료 하려면 첫 번째 작업 집합을 사용 하 여 RanToCompletion 상태의 항상 종료 됩니다.The returned task will always end in the RanToCompletion state with its Result set to the first task to complete. 첫 번째 작업이 완료 되기를 Canceled 또는 Faulted 상태에서 종료 하는 경우에 마찬가지입니다.This is true even if the first task to complete ended in the Canceled or Faulted state.

적용 대상