Force Application to Close [C#]

Shaitan00

Well-known member
Joined
Aug 11, 2003
Messages
343
Location
Hell
In C#, how can we have the application terminate?
I have a Try{}/Catch{} section and if the code enters the Catch{} then a critical error occurred and I do not want the application to continue.

There has to be some simple generic exit command to gracefully terminate the application.
 
if its a console app, use Environment.Exit(int), if its a gui app, use Application.Exit()

u can also do Process.GetCurrentProcess().Kill()
 
Back
Top