AsyncHelperDoOperationAsyncTResult(FuncIAsyncContext, TResult, TResult, TaskConfig) Method
Executes the specified
operation asynchronously.
See the
Examples section of the
AsyncHelper class for details.
Namespace: KGySoft.ThreadingAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
public static Task<TResult> DoOperationAsync<TResult>(
Func<IAsyncContext, TResult> operation,
TResult canceledResult,
TaskConfig? asyncConfig
)
Public Shared Function DoOperationAsync(Of TResult) (
operation As Func(Of IAsyncContext, TResult),
canceledResult As TResult,
asyncConfig As TaskConfig
) As Task(Of TResult)
public:
generic<typename TResult>
static Task<TResult>^ DoOperationAsync(
Func<IAsyncContext^, TResult>^ operation,
TResult canceledResult,
TaskConfig^ asyncConfig
)
static member DoOperationAsync :
operation : Func<IAsyncContext, 'TResult> *
canceledResult : 'TResult *
asyncConfig : TaskConfig -> Task<'TResult>
- operation FuncIAsyncContext, TResult
- The operation to be executed.
- canceledResult TResult
- The result to be returned by the returned task if the operation has been canceled
and ThrowIfCanceled of asyncConfig returns .
- asyncConfig TaskConfig
- The configuration for the asynchronous operation.
- TResult
- The type of the result of the specified operation.
TaskTResultA
TaskTResult that represents the asynchronous operation. Its result is the result of the
operation if it has not been canceled,
or
canceledResult if the operation has been canceled
and
ThrowIfCanceled in
asyncConfig was set to
.