CharEnumerator.IDisposable.Dispose CharEnumerator.IDisposable.Dispose CharEnumerator.IDisposable.Dispose Method


释放 CharEnumerator 类使用的所有资源。Releases all resources used by the CharEnumerator class.

 virtual void System.IDisposable.Dispose() = IDisposable::Dispose;
void IDisposable.Dispose ();
Sub Dispose () Implements IDisposable.Dispose



使用CharEnumerator完类后, 调用 IDisposable。Call IDisposable.Dispose when you are finished using the CharEnumerator class. 方法使CharEnumerator类处于不可用状态。The method leaves the CharEnumerator class in an unusable state. 调用此方法后, 必须释放对CharEnumerator该类的所有引用, 以便垃圾回收器可以回收CharEnumerator类占用的内存。After 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.

有关详细信息, 请参阅清理非托管资源实现 Dispose 方法For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.


在释放对类的CharEnumerator最后一个引用之前, 请始终调用 IDisposable。Always 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.