AsyncHelperFromResultTResult(TResult, 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: 8.1.0
C#
public static TResult FromResult<TResult>(
	TResult result,
	TResult canceledResult,
	ParallelConfig? configuration
)

Parameters

result  TResult
The result to be returned if the operation has not been canceled.
canceledResult  TResult
The result to be returned if the operation has been 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 canceledResult 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