AsyncResult AsyncResult AsyncResult AsyncResult Class

定義

實作 IAsyncResult 介面的抽象基底類別。An abstract base class that implements the IAsyncResult interface. 做為可衍生出IAsyncResult 物件的基底類別,可用於一般的非同步程式設計案例。Serves as a base class from which to derive IAsyncResult objects that can be used for common asynchronous programming scenarios.

public ref class AsyncResult abstract : IAsyncResult, IDisposable
public abstract class AsyncResult : IAsyncResult, IDisposable
type AsyncResult = class
    interface IAsyncResult
    interface IDisposable
Public MustInherit Class AsyncResult
Implements IAsyncResult, IDisposable
繼承
AsyncResultAsyncResultAsyncResultAsyncResult
衍生
實作

備註

如需詳細資訊,請參閱System.IAsyncResult介面。For more information see the System.IAsyncResult interface.

TypedAsyncResult<T> 類別衍生自 AsyncResultThe TypedAsyncResult<T> class derives from AsyncResult.

建構函式

AsyncResult() AsyncResult() AsyncResult() AsyncResult()

從衍生類別中的建構函式呼叫來初始化 AsyncResult 類別的執行個體,這個執行個體沒有回呼委派或狀態物件。Called from constructors in derived classes to initialize an instance of the AsyncResult class that does not have a callback delegate or a state object.

AsyncResult(AsyncCallback, Object) AsyncResult(AsyncCallback, Object) AsyncResult(AsyncCallback, Object) AsyncResult(AsyncCallback, Object)

從衍生類別中的建構函式呼叫來初始化 AsyncResult 類別的執行個體,這個執行個體具有回呼委派和狀態物件。Called from constructors in derived classes to initialize an instance of the AsyncResult class that has a callback delegate and a state object.

AsyncResult(Object) AsyncResult(Object) AsyncResult(Object) AsyncResult(Object)

從衍生類別中的建構函式呼叫來初始化 AsyncResult 類別的執行個體,這個執行個體沒有回呼委派,但有狀態物件。Called from constructors in derived classes to initialize an instance of the AsyncResult class that does not have a callback delegate but does have a state object.

屬性

AsyncState AsyncState AsyncState AsyncState

取得使用者定義的物件,這個物件符合或包含非同步作業的相關資訊。Gets a user-defined object that qualifies or contains information about an asynchronous operation.

AsyncWaitHandle AsyncWaitHandle AsyncWaitHandle AsyncWaitHandle

取得 WaitHandle,用來等候非同步作業完成。Gets a WaitHandle that is used to wait for an asynchronous operation to complete.

CompletedSynchronously CompletedSynchronously CompletedSynchronously CompletedSynchronously

取得值,這個值表示非同步作業是否同步完成。Gets a value that indicates whether the asynchronous operation completed synchronously.

IsCompleted IsCompleted IsCompleted IsCompleted

取得值,這個值表示非同步作業是否完成。Gets a value that indicates whether the asynchronous operation has completed.

方法

Complete(Boolean) Complete(Boolean) Complete(Boolean) Complete(Boolean)

當非同步作業已完成且未發生任何例外狀況時,請呼叫這個版本的完成。Call this version of complete when your asynchronous operation is complete and no exception was encountered. 它會更新作業的狀態,並通知回呼。It updates the state of the operation and notifies the callback.

Complete(Boolean, Exception) Complete(Boolean, Exception) Complete(Boolean, Exception) Complete(Boolean, Exception)

如果您在處理期間引發例外狀況,請呼叫這個版本的完成。Call this version of complete if you raise an exception during processing. 除了通知回呼,它還會擷取並儲存例外狀況,以便在呼叫 End(IAsyncResult) 方法期間擲回。In addition to notifying the callback, it captures the exception and stores it to be thrown during the call to the End(IAsyncResult) method.

Dispose() Dispose() Dispose() Dispose()

AsyncResult 類別的目前執行個體所使用的資源釋出。Releases the resources used by the current instance of the AsyncResult class.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Dispose()Finalize() 方法呼叫,以釋出 AsyncResult 類別之目前執行個體所使用的 Managed 和 Unmanaged 資源。Called by the Dispose() and Finalize() methods to release the managed and unmanaged resources used by the current instance of the AsyncResult class.

End(IAsyncResult) End(IAsyncResult) End(IAsyncResult) End(IAsyncResult)

當非同步作業的 End 函式完成時,請呼叫這個方法。Call this method when the End function for the asynchronous operation is complete. 它可確保非同步作業已完成,而且會執行一些常見的驗證。It ensures that the asynchronous operation is complete, and does some common validation.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

允許 AsyncResult 物件在記憶體回收進行回收之前,嘗試釋放資源並執行其他清除作業。Allows the AsyncResult object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於