Edit

Share via


TaskFactory<TResult>.FromAsync Method

Definition

Creates a task instance.

Overloads

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>)

Creates a task that executes an end method function when a specified IAsyncResult completes.

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions)

Creates a task that executes an end method function when a specified IAsyncResult completes.

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler)

Creates a task that executes an end method function when a specified IAsyncResult completes.

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback, Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions)

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that executes an end method function when a specified IAsyncResult completes.

public System.Threading.Tasks.Task<TResult> FromAsync(IAsyncResult asyncResult, Func<IAsyncResult,TResult> endMethod);

Parameters

asyncResult
IAsyncResult

The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

The function delegate that processes the completed asyncResult.

Returns

A Task<TResult> that represents the asynchronous operation.

Exceptions

The asyncResult argument is null.

-or-

The endMethod argument is null.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync(Func<AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object state);
public System.Threading.Tasks.Task<TResult> FromAsync(Func<AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object? state);

Parameters

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

state
Object

An object containing data to be used by the beginMethod delegate.

Returns

The created task that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that executes an end method function when a specified IAsyncResult completes.

public System.Threading.Tasks.Task<TResult> FromAsync(IAsyncResult asyncResult, Func<IAsyncResult,TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions);

Parameters

asyncResult
IAsyncResult

The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

The function delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions

One of the enumeration values that controls the behavior of the created task.

Returns

A task that represents the asynchronous operation.

Exceptions

The asyncResult argument is null.

-or-

The endMethod argument is null.

The creationOptions argument specifies an invalid value.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync(Func<AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync(Func<AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions);

Parameters

beginMethod
Func<AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

state
Object

An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

One of the enumeration values that controls the behavior of the created task.

Returns

The created Task<TResult> that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

The creationOptions argument specifies an invalid value.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that executes an end method function when a specified IAsyncResult completes.

public System.Threading.Tasks.Task<TResult> FromAsync(IAsyncResult asyncResult, Func<IAsyncResult,TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler);

Parameters

asyncResult
IAsyncResult

The IAsyncResult whose completion should trigger the processing of the endMethod.

endMethod
Func<IAsyncResult,TResult>

The function delegate that processes the completed asyncResult.

creationOptions
TaskCreationOptions

One of the enumeration values that controls the behavior of the created task.

scheduler
TaskScheduler

The task scheduler that is used to schedule the task that executes the end method.

Returns

The created task that represents the asynchronous operation.

Exceptions

The asyncResult argument is null.

-or-

The endMethod argument is null.

-or-

The scheduler argument is null.

The creationOptions parameter specifies an invalid value.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback, Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions);

Type Parameters

TArg1

The type of the second argument passed to beginMethod delegate.

TArg2

The type of the third argument passed to beginMethod delegate.

TArg3

The type of the first argument passed to the beginMethod delegate.

Parameters

beginMethod
Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

arg1
TArg1

The first argument passed to the beginMethod delegate.

arg2
TArg2

The second argument passed to the beginMethod delegate.

arg3
TArg3

The third argument passed to the beginMethod delegate.

state
Object

An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

An object that controls the behavior of the created task.

Returns

The created task that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

The creationOptions parameter specifies an invalid value.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state);

Type Parameters

TArg1

The type of the second argument passed to beginMethod delegate.

TArg2

The type of the third argument passed to beginMethod delegate.

TArg3

The type of the first argument passed to the beginMethod delegate.

Parameters

beginMethod
Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

arg1
TArg1

The first argument passed to the beginMethod delegate.

arg2
TArg2

The second argument passed to the beginMethod delegate.

arg3
TArg3

The third argument passed to the beginMethod delegate.

state
Object

An object containing data to be used by the beginMethod delegate.

Returns

The created task that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions);

Type Parameters

TArg1

The type of the second argument passed to beginMethod delegate.

TArg2

The type of the first argument passed to the beginMethod delegate.

Parameters

beginMethod
Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

arg1
TArg1

The first argument passed to the beginMethod delegate.

arg2
TArg2

The second argument passed to the beginMethod delegate.

state
Object

An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

An object that controls the behavior of the created Task<TResult>.

Returns

The created task that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

The creationOptions parameter specifies an invalid value.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state);

Type Parameters

TArg1

The type of the second argument passed to beginMethod delegate.

TArg2

The type of the first argument passed to the beginMethod delegate.

Parameters

beginMethod
Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

arg1
TArg1

The first argument passed to the beginMethod delegate.

arg2
TArg2

The second argument passed to the beginMethod delegate.

state
Object

An object containing data to be used by the beginMethod delegate.

Returns

The created task that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object state);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(Func<TArg1,AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object? state);

Type Parameters

TArg1

The type of the first argument passed to the beginMethod delegate.

Parameters

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

arg1
TArg1

The first argument passed to the beginMethod delegate.

state
Object

An object containing data to be used by the beginMethod delegate.

Returns

The created task that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(Func<TArg1,AsyncCallback,object,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object state, System.Threading.Tasks.TaskCreationOptions creationOptions);
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(Func<TArg1,AsyncCallback,object?,IAsyncResult> beginMethod, Func<IAsyncResult,TResult> endMethod, TArg1 arg1, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions);

Type Parameters

TArg1

The type of the first argument passed to the beginMethod delegate.

Parameters

beginMethod
Func<TArg1,AsyncCallback,Object,IAsyncResult>

The delegate that begins the asynchronous operation.

endMethod
Func<IAsyncResult,TResult>

The delegate that ends the asynchronous operation.

arg1
TArg1

The first argument passed to the beginMethod delegate.

state
Object

An object containing data to be used by the beginMethod delegate.

creationOptions
TaskCreationOptions

One of the enumeration values that controls the behavior of the created task.

Returns

The created task that represents the asynchronous operation.

Exceptions

The beginMethod argument is null.

-or-

The endMethod argument is null.

The creationOptions parameter specifies an invalid value.

Remarks

This method throws any exceptions thrown by the beginMethod. Exceptions for endmethod are thrown when waiting on the returned task.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0