共用方式為


IDTExtensibility2.OnBeginShutdown Method

Occurs whenever the Visual Studio integrated development environment (IDE) shuts down while an add-in is running.

Namespace:  Extensibility
Assembly:  Extensibility (in Extensibility.dll)

Syntax

'Declaration
Sub OnBeginShutdown ( _
    ByRef custom As Array _
)
void OnBeginShutdown(
    ref Array custom
)
void OnBeginShutdown(
    [InAttribute] Array^% custom
)
abstract OnBeginShutdown : 
        custom:Array byref -> unit
function OnBeginShutdown(
    custom : Array
)

Parameters

  • custom
    Type: System.Array%

    An empty array that you can use to pass host-specific data for use in the add-in.

Remarks

Although a shutdown of Visual Studio might be canceled, the OnBeginShutdown method cannot be canceled. As a result, add-ins should assume that all shutdown events occur and perform any cleanup routines accordingly.

This method can be used to store the settings of the add-in at the time that Visual Studio shuts down so that it can be restored later to its original state.

Examples

Public Sub OnBeginShutdown(ByRef custom As Array) Implements _
IDTExtensibility2.OnBeginShutdown
    MsgBox("Place cleanup code here.")
End Sub
public void OnBeginShutdown(ref Array custom)
{
    // Place cleanup code here.
    System.Windows.Forms.MessageBox.Show("Shutting down Visual 
    Studio");
}

.NET Framework Security

See Also

Reference

IDTExtensibility2 Interface

Extensibility Namespace

IDTExtensibility2

OnConnection

OnDisconnection

OnAddInsUpdate

OnStartupComplete

Other Resources

How to: Create an Add-In