System.Threading.Tasks.TaskFactory.FromAsync Method

Creates a System.Threading.Tasks.Task that executes an end method action when a specified IAsyncResult completes.

Syntax

public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod)

Parameters

asyncResult
The IAsyncResult whose completion should trigger the processing of the endMethod.
endMethod
The action delegate that processes the completed asyncResult.

Returns

A System.Threading.Tasks.Task that represents the asynchronous operation.

Remarks

Note:

The erload:System.Threading.Tasks.TaskFactory.FromAsync overloads that take an asyncResult parameter are not as efficient as the overloads that take a beginMethod parameter. If performance is an issue, use the overloads that provide the beginMethod/endMethod pattern.

Requirements

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