I used to call Application.Exit
terminate my application. At some point in time, I start to use a DLL, and I cannot fully terminate my application (a thread is running).
However, I can call Environment.Exit(0)
and terminate my app completely.
I have read some useful posts.
[http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx][2]
It seems
Application.Exit()
is recommended for Windows application and
Environment.Exit(exitCode)
is recommended for console application
That's what I read from other posts.
===== The reason that I asked this question, and Something is still unclear to me:
Now, I just add Environment.Exit(0)
at the end of Application.Exit
event handler, since I had the event handler for Application.Exit
and save some state information in the handler.
I am still not sure that I use this in a correct way. In other words, does this make sense to call both Application.Exit() and Environment.Exit(exitCode)