TaskCompletionSourceExtensionsSetFromTaskTResult Method (TaskCompletionSourceTResult, Task, TResult) |
Namespace: Rackspace.Threading
public static void SetFromTask<TResult>( this TaskCompletionSource<TResult> taskCompletionSource, Task task, TResult result )
Exception | Condition |
---|---|
ArgumentNullException |
If taskCompletionSource is . -or- If task is . |
ObjectDisposedException |
If the underlying TaskTResult of taskCompletionSource was disposed. |
InvalidOperationException |
If the underlying TaskTResult produced by taskCompletionSource is already in one of the three final states: RanToCompletion, Faulted, or Canceled. |
If task is in the RanToCompletion state, the specified result value is assigned to the TaskCompletionSourceTResult using the SetResult(TResult) method.
If task is in the Faulted state, the unwrapped exceptions are bound to the TaskCompletionSourceTResult using the SetException(IEnumerableException) method.
If task is in the Canceled state, the TaskCompletionSourceTResult is transitioned to the Canceled state using the SetCanceled method.