Click or drag to resize

AsyncResultT Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
An object to track the status of an operation that may be performed either synchronously or asynchronously. See remarks.
Inheritance Hierarchy
SystemObject
  Telogis.GeoBase.ConcurrencyAsyncResultT

Namespace:  Telogis.GeoBase.Concurrency
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public class AsyncResult<T> : IAsyncResult
where T : class

Type Parameters

T
The type of object that will be returned by the operation.

The AsyncResultT type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyAsyncState
The user object that is associated with the operation.
Public propertyAsyncWaitHandle
A handle that may be used to wait for the operation to complete.
Public propertyCompletedSynchronously
Whether the operation completed synchronously.
Public propertyException
This is an exception thrown by the asynchronous operation, if any. If no exception is thrown, will be null.
Public propertyIsCompleted
Whether the operation is complete.
Public propertyResult
The result of the operation.
Top
Methods
  NameDescription
Public methodStatic memberBegin
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.
Public methodEndSynchronous
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.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodSetException
Sets an exception result for this Asynchronous operation. If a result has already been set this function will re-throw an AsyncException.
Public methodSetResult
Sets the result of the operation and calls the operation's callback.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
The typical pattern of usage is:
C#
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;
}
See Also