共用方式為


Package.Dispose(Boolean) Method

Definition

Releases the resources used by the Package object.

protected:
 virtual void Dispose(bool disposing);
protected:
 virtual void Dispose(bool disposing);
 virtual void Dispose(bool disposing);
protected virtual void Dispose (bool disposing);
abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit
Protected Overridable Sub Dispose (disposing As Boolean)

Parameters

disposing
Boolean

true if the object is being disposed, false if it is being finalized.

Remarks

The Dispose method is called when the VSPackage is being destroyed by Visual Studio. This is typically in response to a call to Close. (Neither Visual Studio nor the Package class implements a finalizer. Unless a separate finalizer is implemented, the Dispose method is always called with disposing set to true.)

A finalizer is a method that handles the destruction of unmanaged resources from within managed code. Finalizers run on a separate thread and impact the performance of the .NET Framework garbage collector, so you should avoid using them unnecessarily. For additional information on finalizers, see Finalize Methods and Destructors.

The default implementation of the Dispose method performs the following tasks:

  • Unregisters any registered editor factories.

  • Disposes any editor factories that also implement the IDisposable interface.

  • Disposes all dialog pages.

  • Revokes all services.

  • Disposes any services that implement the IDisposable interface.

If you override the Dispose method, be sure to call base.Dispose from within the overriding method.

Applies to