AsyncFlowControl.Dispose 方法

定義

釋放 AsyncFlowControl 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the AsyncFlowControl class.

public:
 virtual void Dispose();
public void Dispose ();
abstract member Dispose : unit -> unit
override this.Dispose : unit -> unit
Public Sub Dispose ()

實作

例外狀況

AsyncFlowControl 結構不是在建立此結構的執行緒上使用。The AsyncFlowControl structure is not used on the thread where it was created.

-或--or- AsyncFlowControl 結構已經用來呼叫 Dispose()Undo()The AsyncFlowControl structure has already been used to call Dispose() or Undo().

備註

Dispose 使用完畢時,請呼叫 AsyncFlowControlCall Dispose when you are finished using the AsyncFlowControl. Dispose 方法會將 AsyncFlowControl 保留在無法使用的狀態。The Dispose method leaves the AsyncFlowControl in an unusable state. 呼叫 Dispose之後,您必須釋放所有對 AsyncFlowControl 的參考,讓垃圾收集行程可以回收 AsyncFlowControl 所佔用的記憶體。After calling Dispose, you must release all references to the AsyncFlowControl so the garbage collector can reclaim the memory that the AsyncFlowControl was occupying.

如需詳細資訊,請參閱清除非受控資源執行 Dispose 方法For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

注意

在您釋放最後一個 Dispose 參考之前,請務必呼叫 AsyncFlowControlAlways call Dispose before you release your last reference to the AsyncFlowControl. 否則工作窗格所使用的資源不會釋放,直到記憶體回收行程呼叫 AsyncFlowControl 物件的 Finalize 方法。Otherwise, the resources it is using will not be freed until the garbage collector calls the AsyncFlowControl object's Finalize method.

適用於

另請參閱