Επεξεργασία

Κοινή χρήση μέσω


TaskCompletionSource<TResult>.SetFromTask(Task<TResult>) Method

Definition

Transitions the underlying Task<TResult> into the same completion state as the specified completedTask.

public:
 void SetFromTask(System::Threading::Tasks::Task<TResult> ^ completedTask);
public void SetFromTask (System.Threading.Tasks.Task<TResult> completedTask);
member this.SetFromTask : System.Threading.Tasks.Task<'Result> -> unit
Public Sub SetFromTask (completedTask As Task(Of TResult))

Parameters

completedTask
Task<TResult>

The completed task whose completion status (including result, exception, or cancellation information) should be copied to the underlying task.

Exceptions

completedTask is null.

completedTask is not completed.

The underlying Task<TResult> is already in one of the three final states: RanToCompletion, Faulted, or Canceled.

Remarks

This operation will return false if the Task<TResult> is already in one of the three final states: RanToCompletion, Faulted, or Canceled.

Applies to