/// <param name="stateObject">An object that contains state information for this request.</param>
/// <param name="stateObject">An object that contains state information for this request.</param>
internalIAsyncProxyResult(objectstateObject=null)
internalIAsyncProxyResult(objectstateObject=null)
{
{
_stateObject=stateObject;
AsyncState=stateObject;
_completed=false;
IsCompleted=false;
if(_waitHandle!=null)
_waitHandle?.Reset();
_waitHandle.Reset();
}
}
/// <summary>Initializes the internal variables of this object</summary>
/// <summary>Initializes the internal variables of this object</summary>
internalvoidReset()
internalvoidReset()
{
{
_stateObject=null;
//AsyncState = null;
_completed=true;
IsCompleted=true;
if(_waitHandle!=null)
_waitHandle?.Set();
_waitHandle.Set();
}
}
/// <summary>Gets a value that indicates whether the server has completed processing the call. It is illegal for the server to use any client supplied resources outside of the agreed upon sharing semantics after it sets the IsCompleted property to "true". Thus, it is safe for the client to destroy the resources after IsCompleted property returns "true".</summary>
/// <summary>Gets a value that indicates whether the server has completed processing the call. It is illegal for the server to use any client supplied resources outside of the agreed upon sharing semantics after it sets the IsCompleted property to "true". Thus, it is safe for the client to destroy the resources after IsCompleted property returns "true".</summary>
/// <value>A boolean that indicates whether the server has completed processing the call.</value>
/// <value>A boolean that indicates whether the server has completed processing the call.</value>
publicboolIsCompleted
publicboolIsCompleted{get;privateset;}
{
get
{
return_completed;
}
}
/// <summary>Gets a value that indicates whether the BeginXXXX call has been completed synchronously. If this is detected in the AsyncCallback delegate, it is probable that the thread that called BeginInvoke is the current thread.</summary>
/// <summary>Gets a value that indicates whether the BeginXXXX call has been completed synchronously. If this is detected in the AsyncCallback delegate, it is probable that the thread that called BeginInvoke is the current thread.</summary>
/// <value>Returns false.</value>
/// <value>Returns false.</value>
publicboolCompletedSynchronously
publicboolCompletedSynchronously=>false;
{
get
{
returnfalse;
}
}
/// <summary>Gets an object that was passed as the state parameter of the BeginXXXX method call.</summary>
/// <summary>Gets an object that was passed as the state parameter of the BeginXXXX method call.</summary>
/// <value>The object that was passed as the state parameter of the BeginXXXX method call.</value>
/// <value>The object that was passed as the state parameter of the BeginXXXX method call.</value>
publicobjectAsyncState
publicobjectAsyncState{get;privateset;}
{
get
{
return_stateObject;
}
}
/// <summary>
/// <summary>
/// The AsyncWaitHandle property returns the WaitHandle that can use to perform a WaitHandle.WaitOne or WaitAny or WaitAll. The object which implements IAsyncResult need not derive from the System.WaitHandle classes directly. The WaitHandle wraps its underlying synchronization primitive and should be signaled after the call is completed. This enables the client to wait for the call to complete instead polling. The Runtime supplies a number of waitable objects that mirror Win32 synchronization primitives e.g. ManualResetEvent, AutoResetEvent and Mutex.
/// The AsyncWaitHandle property returns the WaitHandle that can use to perform a WaitHandle.WaitOne or WaitAny or WaitAll. The object which implements IAsyncResult need not derive from the System.WaitHandle classes directly. The WaitHandle wraps its underlying synchronization primitive and should be signaled after the call is completed. This enables the client to wait for the call to complete instead polling. The Runtime supplies a number of waitable objects that mirror Win32 synchronization primitives e.g. ManualResetEvent, AutoResetEvent and Mutex.
/// WaitHandle supplies methods that support waiting for such synchronization objects to become signaled with "any" or "all" semantics i.e. WaitHandle.WaitOne, WaitAny and WaitAll. Such methods are context aware to avoid deadlocks. The AsyncWaitHandle can be allocated eagerly or on demand. It is the choice of the IAsyncResult implementer.
/// WaitHandle supplies methods that support waiting for such synchronization objects to become signaled with "any" or "all" semantics i.e. WaitHandle.WaitOne, WaitAny and WaitAll. Such methods are context aware to avoid deadlocks. The AsyncWaitHandle can be allocated eagerly or on demand. It is the choice of the IAsyncResult implementer.
///</summary>
///</summary>
/// <value>The WaitHandle associated with this asynchronous result.</value>
/// <value>The WaitHandle associated with this asynchronous result.</value>