AsyncResultT Class |
Namespace: Telogis.GeoBase.Concurrency
The AsyncResultT type exposes the following members.
Name | Description | |
---|---|---|
AsyncResultT(AsyncCallback, Object) |
Sets up an AsyncResult for an asynchronous operation.
| |
AsyncResultT(AsyncCallback, Object, T) |
Sets up an AsyncResult for an operation that could have been asynchronous but in fact
has already been performed synchronously.
|
Name | Description | |
---|---|---|
AsyncState |
The user object that is associated with the operation.
| |
AsyncWaitHandle |
A handle that may be used to wait for the operation to complete.
| |
CompletedSynchronously |
Whether the operation completed synchronously.
| |
Exception |
This is an exception thrown by the asynchronous operation, if any. If no exception is thrown, will be null.
| |
IsCompleted |
Whether the operation is complete.
| |
Result |
The result of the operation.
|
Name | Description | |
---|---|---|
Begin |
Called at the beginning of a synchronous or asynchronous operation. This method will also construct an AsyncResult
object from the arguments provided and return it.
| |
EndSynchronous |
Called at the end of synchronous processing for the operation. If the operation is
complete, ie SetResult has been called, then the operation was synchronous. Otherwise,
the operation will be completed asynchronously.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
SetException |
Sets an exception result for this Asynchronous operation.
If a result has already been set this function will re-throw an AsyncException.
| |
SetResult |
Sets the result of the operation and calls the operation's callback.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
public IAsyncResult BeginOperation(AsyncCallback userCallback, object userState) { AsyncResult<T> result = new AsyncResult<T>(userCallback, userState); // Call result.SetResult if the operation can be done synchronously. // Otherwise start a thread or similar to perform the operation. result.EndSynchronous(); return result; } public T EndOperation(IAsyncResult result) { return ((AsyncResult<T>)result).Result; }