Application.Shutdown Application.Shutdown Application.Shutdown Application.Shutdown Method

Definition

Shuts down an application.

Overloads

Shutdown() Shutdown() Shutdown() Shutdown()

Shuts down an application.

Shutdown(Int32) Shutdown(Int32) Shutdown(Int32) Shutdown(Int32)

Shuts down an application that returns the specified exit code to the operating system.

Shutdown() Shutdown() Shutdown() Shutdown()

Shuts down an application.

public:
 void Shutdown();
public void Shutdown ();
member this.Shutdown : unit -> unit
Public Sub Shutdown ()

Remarks

When Shutdown is called, an application stops running. You can handle the Exit event to detect when an application is about to stop running, to perform any appropriate processing.

Shutdown is implicitly called by Windows Presentation Foundation in the following situations:

Calling Shutdown explicitly causes an application to shut down, regardless of the ShutdownMode setting. However, if ShutdownMode is set to OnExplicitShutdown, you must call Shutdown to shut down an application.

Important

When Shutdown is called, the application will shut down irrespective of whether the Closing event of any open windows is canceled.

This method can be called only from the thread that created the Application object.

Security

UIPermission
for permission to use all windows and user input events without restriction. Associated enumeration: AllWindows

See also

Shutdown(Int32) Shutdown(Int32) Shutdown(Int32) Shutdown(Int32)

Shuts down an application that returns the specified exit code to the operating system.

public:
 void Shutdown(int exitCode);
[System.Security.SecurityCritical]
public void Shutdown (int exitCode);
member this.Shutdown : int -> unit
Public Sub Shutdown (exitCode As Integer)

Parameters

exitCode
Int32 Int32 Int32 Int32

An integer exit code for an application. The default exit code is 0.

Remarks

You can handle the Exit event to set an exit code. However, if you explicitly call Shutdown, and you handle Exit only to set an exit code, you can call Shutdown instead.

This method can be called only from the thread that created the Application object.

See Environment.ExitCode for information on exit codes.

Security

UIPermission
for permission to use all windows and user input events without restriction. Associated enumeration: AllWindows

See also

Applies to