AsyncHelperEndOperationTResult(IAsyncResult, String) Method

Waits for the completion of an operation started by a corresponding BeginOperation or FromResult call. If the operation is still running, then this method blocks the caller and waits for the completion. The possibly occurred exceptions are also thrown then this method is called.
See the Examples section of the AsyncHelper class for details.

Definition

Namespace: KGySoft.Threading
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
C#
public static TResult EndOperation<TResult>(
	IAsyncResult asyncResult,
	string beginMethodName
)

Parameters

asyncResult  IAsyncResult
The result of a corresponding BeginOperation or FromResult call.
beginMethodName  String
The same name that was passed to the BeginOperation or FromResult method.

Type Parameters

TResult
The type of the result.

Return Value

TResult
The result of the operation, or a default value representing the canceled result if the operation has been canceled and ThrowIfCanceled in the asyncConfig parameter was set to .

Exceptions

ArgumentNullExceptionasyncResult is .
InvalidOperationExceptionasyncResult was not returned by the corresponding BeginOperation or FromResult methods with a matching beginMethodName
-or-
this method was already called for this asyncResult instance.
OperationCanceledExceptionThe operation has been canceled and ThrowIfCanceled in the corresponding AsyncConfig was .

See Also