TaskExtensions.Unwrap Method (Task<Task>)
Creates a proxy Task that represents the asynchronous operation of a Task<Task>.
Assembly: System.Core (in System.Core.dll)
'Declaration <ExtensionAttribute> _ Public Shared Function Unwrap ( _ task As Task(Of Task) _ ) As Task
public static Task Unwrap( this Task<Task> task )
A Task that represents the asynchronous operation of the provided System.Threading.Tasks.Task(Of Task).
The exception that is thrown if the task argument is null.
It is often useful to be able to return a Task from a Task<TResult>, where the inner Task represents work done as part of the outer Task<TResult>. However, doing so results in a Task<Task> (C#) or Task (Of Task) (Visual Basic), which, if not dealt with carefully, could produce unexpected behavior. Unwrap solves this problem by creating a proxy Task that represents the entire asynchronous operation of such a task.
The following example shows how to unwrap a task:
Supported in: 5
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.