MessageBuffer.IDisposable.Dispose 方法

定义

释放由 MessageBuffer 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the MessageBuffer and optionally releases the managed resources. 无法继承此方法。This method cannot be inherited.

 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

实现

注解

使用完 MessageBuffer 后调用此方法。Call this method when you are finished using the MessageBuffer. 此方法使 MessageBuffer 处于不可用状态。This method leaves the MessageBuffer in an unusable state. 调用完此方法后,必须释放对 MessageBuffer 的所有引用,这样垃圾回收器才能收回 MessageBuffer 占用的内存。After calling this method, you must release all references to the MessageBuffer so the garbage collector can reclaim the memory that the MessageBuffer was occupying.

备注

每次释放对 MessageBuffer 的最后一个引用之前,均应调用此方法。Always call this method before you release your last reference to the MessageBuffer. 否则,在垃圾回收器调用 MessageBuffer 对象的 Finalize 方法之前,不会释放正在使用的资源。Otherwise, the resources it is using are not freed until the garbage collector calls the MessageBuffer object's Finalize method.

适用于