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

Definition

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

C#
public void SetFromTask(System.Threading.Tasks.Task<TResult> completedTask);

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

Táirge Leaganacha
.NET 9, 10