Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Write for Dev102
Posted by Shahar Y on Jun 24th, 2008 | Filed under .Net, C# | 3 Comments

image

The question in the title does not refer to the actions you take when you are about to exit your application, issues like logging, closing file handles, freeing unmanaged resources and so on. It does literally refer to the exit action itself:

  • Do you use Application.Exit or Environment.Exit?
  • Where do you call the exit method?

The idea for that post came to my mind after I had to solve a weird bug where pressing the Exit button led to a freeze in an application that I work on. It turned out that I was not using the proper Exit method although I was aware to the fact that there are 2 possibilities. Sometimes, when you are in a middle of a coding momentum, writing a lot of code, you can miss the little details. Those will come back to hunt you later on,  and the most difficult thing about it is that everything was functioning fine for about a year before the bug showed his ugly face.

Lets first understand the difference between the 2 Exit methods:


Continue Reading...
Write Article for Dev102

Write for Dev102!

We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution

Learn More