Package.Dispose Method
Releases the resources used by the Package object.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Syntax
'宣告
Protected Overridable Sub Dispose ( _
disposing As Boolean _
)
'用途
Dim disposing As Boolean
Me.Dispose(disposing)
protected virtual void Dispose(
bool disposing
)
protected:
virtual void Dispose(
bool disposing
)
abstract Dispose :
disposing:bool -> unit
override Dispose :
disposing:bool -> unit
protected function Dispose(
disposing : boolean
)
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.