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, TaskCreationOptions creationOptions, TaskScheduler scheduler)

Parameters

asyncResult
The IAsyncResult whose completion should trigger the processing of the endMethod.
endMethod
The action delegate that processes the completed asyncResult.
creationOptions
The TaskCreationOptions value that controls the behavior of the created System.Threading.Tasks.Task.
scheduler
The System.Threading.Tasks.TaskScheduler that is used to schedule the task that executes the end method.

Returns

The created 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