แก้ไข

แชร์ผ่าน


TaskToAsyncResult.Unwrap Method

Definition

Overloads

Unwrap(IAsyncResult)

Extracts the underlying Task from an IAsyncResult created by Begin(Task, AsyncCallback, Object).

Unwrap<TResult>(IAsyncResult)

Extracts the underlying Task<TResult> from an IAsyncResult created by Begin(Task, AsyncCallback, Object).

Unwrap(IAsyncResult)

Source:
TaskToAsyncResult.cs
Source:
TaskToAsyncResult.cs

Extracts the underlying Task from an IAsyncResult created by Begin(Task, AsyncCallback, Object).

public:
 static System::Threading::Tasks::Task ^ Unwrap(IAsyncResult ^ asyncResult);
public static System.Threading.Tasks.Task Unwrap (IAsyncResult asyncResult);
static member Unwrap : IAsyncResult -> System.Threading.Tasks.Task
Public Shared Function Unwrap (asyncResult As IAsyncResult) As Task

Parameters

Returns

The Task wrapped by the IAsyncResult.

Exceptions

asyncResult is null.

asyncResult was not produced by a call to Begin(Task, AsyncCallback, Object).

Applies to

Unwrap<TResult>(IAsyncResult)

Source:
TaskToAsyncResult.cs
Source:
TaskToAsyncResult.cs

Extracts the underlying Task<TResult> from an IAsyncResult created by Begin(Task, AsyncCallback, Object).

public:
generic <typename TResult>
 static System::Threading::Tasks::Task<TResult> ^ Unwrap(IAsyncResult ^ asyncResult);
public static System.Threading.Tasks.Task<TResult> Unwrap<TResult> (IAsyncResult asyncResult);
static member Unwrap : IAsyncResult -> System.Threading.Tasks.Task<'Result>
Public Shared Function Unwrap(Of TResult) (asyncResult As IAsyncResult) As Task(Of TResult)

Type Parameters

TResult

The type of the result produced by the returned task.

Parameters

Returns

The Task<TResult> wrapped by the IAsyncResult.

Exceptions

asyncResult is null.

asyncResult was not produced by a call to Begin(Task, AsyncCallback, Object), or the Task<TResult> provided to Begin(Task, AsyncCallback, Object) was used a generic type parameter that's different from the TResult supplied to this call.

Applies to