Share via


TaskCompletionSource<TResult>.Task Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the Task<TResult> created by this TaskCompletionSource<TResult>.

Namespace:  System.Threading.Tasks
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public ReadOnly Property Task As Task(Of TResult)
public Task<TResult> Task { get; }

Property Value

Type: System.Threading.Tasks.Task<TResult>
Returns the Task<TResult> created by this TaskCompletionSource<TResult>.

Remarks

This property enables a consumer to access the Task<TResult> that is controlled by this instance. When you create a TaskCompletionSource<TResult> object, the Task<TResult> property of this Task<TResult> object returns WaitingForActivation.

The SetResult, SetException, SetException, and SetCanceled methods (and their "Try" variants) on this instance all result in the relevant state transitions on this underlying Task.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.