Click or drag to resize
TaskCompletionSourceExtensions.SetFromTask<TSource, TResult> Method (TaskCompletionSource<TResult>, Task<TSource>)

Namespace: Rackspace.Threading
Assembly: Rackspace.Threading (in Rackspace.Threading.dll) Version: 2.1.0-beta1
Syntax
public static void SetFromTask<TSource, TResult>(
	this TaskCompletionSource<TResult> taskCompletionSource,
	Task<TSource> task
)
where TSource : TResult

Parameters

taskCompletionSource
Type: System.Threading.Tasks.TaskCompletionSource<TResult>
The TaskCompletionSource<TResult> instance.
task
Type: System.Threading.Tasks.Task<TSource>
The result task whose completion results should be transferred.

Type Parameters

TSource
Specifies the result type of the source Task<TResult>.
TResult
Specifies the result type of the TaskCompletionSource<TResult>.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type TaskCompletionSource<TResult>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullException

If taskCompletionSource is null.

-or-

If task is null.

ObjectDisposedException

If the underlying Task<TResult> of taskCompletionSource was disposed.

InvalidOperationException

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

Remarks
Version Information

.NET for Windows Store apps

Supported in: Windows 8

.NET Framework

Supported in: 4.5, 4.0, 3.5

Portable Class Library

Supported in: Portable Class Library (Legacy), Portable Class Library

Threading Library

Supported in: 2.1, 2.0, 1.1
See Also