Edit

Kongsi melalui


TaskCompletionSource.SetFromTask(Task) Method

Definition

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

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

Parameters

completedTask
Task

The completed task whose completion status (including 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