System.Threading.Tasks.TaskFactory.FromAsync Method

Creates a System.Threading.Tasks.Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

Syntax

public Task FromAsync (Func<AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object state)

Parameters

beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
state
An object containing data to be used by the beginMethod delegate.

Returns

The created System.Threading.Tasks.Task that represents the asynchronous operation.

Remarks

The beginMethod delegate is started on the thread that erload:System.Threading.Tasks.TaskFactory.FromAsync is running on. This method throws any exceptions thrown by the beginMethod.

Requirements

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