Επεξεργασία

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


TaskCompletionSource.TrySetFromTask(Task) Method

Definition

Attempts to transition the underlying Task<TResult> into the same completion state as the specified completedTask.

public:
 bool TrySetFromTask(System::Threading::Tasks::Task ^ completedTask);
public bool TrySetFromTask (System.Threading.Tasks.Task completedTask);
member this.TrySetFromTask : System.Threading.Tasks.Task -> bool
Public Function TrySetFromTask (completedTask As Task) As Boolean

Parameters

completedTask
Task

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

Returns

true if the operation was successful; otherwise, false.

Exceptions

completedTask is null.

completedTask is not completed.

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