AsyncHelperBeginOperationTResult(FuncIAsyncContext, TResult, TResult, AsyncConfig, String) Method

Exposes the specified operation with a return value as an IAsyncResult-returning async operation. To obtain the result the EndOperation method must be called.
See the Examples section of the AsyncHelper class for details.


Namespace: KGySoft.Threading
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.2.0
public static IAsyncResult BeginOperation<TResult>(
	Func<IAsyncContext, TResult> operation,
	TResult canceledResult,
	AsyncConfig? asyncConfig,
	string beginMethodName = null


operation  FuncIAsyncContext, TResult
The operation to be executed.
canceledResult  TResult
The result to be returned by EndOperation if the operation is canceled and ThrowIfCanceled of asyncConfig returns .
asyncConfig  AsyncConfig
The configuration for the asynchronous operation.
beginMethodName  String  (Optional)
The name of the method that represents the operation. This must be passed also to the EndOperation method. This parameter is optional.
Default value: The name of the caller method when used with a compiler that recognizes CallerMemberNameAttribute; otherwise, .

Type Parameters

The type of the result of the specified operation.

Return Value

An IAsyncResult instance representing the asynchronous operation. To complete the operation it must be passed to the EndOperation method.


ArgumentNullExceptionoperation or beginMethodName is .

See Also