AsyncHelperDoOperationSynchronouslyTResult(FuncIAsyncContext, TResult, TResult, ParallelConfig) Method

Executes the specified operation synchronously, in which some sub-operations may run in parallel.
See the Examples section of the AsyncHelper class for details.

Definition

Namespace: KGySoft.Threading
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.2.0
C#
public static TResult DoOperationSynchronously<TResult>(
	Func<IAsyncContext, TResult> operation,
	TResult canceledResult,
	ParallelConfig? configuration
)

Parameters

operation  FuncIAsyncContext, TResult
The operation to be executed.
canceledResult  TResult
The result to be returned if the operation has been canceled and ThrowIfCanceled of configuration returns .
configuration  ParallelConfig
The configuration for the operation.

Type Parameters

TResult
The type of the result of the specified operation.

Return Value

TResult
The result of the operation if the operation has not been canceled, or canceledResult if the operation has been canceled and ThrowIfCanceled in configuration was set to .

Exceptions

ArgumentNullExceptionoperation is .
OperationCanceledExceptionThe operation has been canceled and ThrowIfCanceled in configuration was .

See Also