Compartilhar via


Package.Dispose Method

Releases the resources used by the Package object.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)

Syntax

'Declaração
Protected Overridable Sub Dispose ( _
    disposing As Boolean _
)
protected virtual void Dispose(
    bool disposing
)

Parameters

  • disposing
    Type: System.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.

.NET Framework Security

See Also

Reference

Package Class

Microsoft.VisualStudio.Shell Namespace