Hi PeteZ,
Hi,
This may seem like a silly question but I'll ask anyway 8^)
I have a C# Windows "Console Application" that when a fatal error occurs,
I'll log the error and I then want to stop the program in its tracks ie.
terminate immeadiately.
Is there a call to do this eg. Application.Terminate ();
- peteZ
The best practise is to close application with normal
code process e.g.
formMain.Close() // in Windows application
or
return; // from Main() functions in console application.
But there are two other "fast" ways to close application:
1) Application.Exit();
2) create your own exception, e.g. MyExitException()
- throw it in wanted "exit" place
- catch it in Main(...) function e.g.:
public static void Main(string[] args) {
try {
// your application code
}
catch(MyExitException ) {
return;
}
}