AsyncHelperFromResultTResult(TResult, ParallelConfig) Method

This method can be used to immediately return from a synchronous operation that has a return value.
See the Examples section of the AsyncHelper class for details.

Definition

Namespace: KGySoft.Threading
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public static TResult FromResult<TResult>(
	TResult result,
	ParallelConfig? configuration
)

Parameters

result  TResult
The result to be returned if the operation was not canceled.
configuration  ParallelConfig
The configuration for the operation.

Type Parameters

TResult
The type of the result.

Return Value

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

Exceptions

OperationCanceledExceptionThe operation has been canceled and ThrowIfCanceled in configuration was .

See Also