CharEnumerator.IDisposable.Dispose 方法


釋放 CharEnumerator 類別所使用的所有資源。Releases all resources used by the CharEnumerator class.

 virtual void System.IDisposable.Dispose() = IDisposable::Dispose;
void IDisposable.Dispose ();
abstract member System.IDisposable.Dispose : unit -> unit
override this.System.IDisposable.Dispose : unit -> unit
Sub Dispose () Implements IDisposable.Dispose



當您完成使用類別時,請呼叫 IDisposable。 CharEnumeratorCall IDisposable.Dispose when you are finished using the CharEnumerator class. 方法會讓 CharEnumerator 類別離開處於無法使用的狀態。The method leaves the CharEnumerator class in an unusable state. 在呼叫之後,您必須釋放類別的所有參考, CharEnumerator 讓垃圾收集行程可以回收類別所佔用的記憶體 CharEnumeratorAfter calling it, you must release all references to the CharEnumerator class so the garbage collector can reclaim the memory that the CharEnumerator class was occupying.

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


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