title: When should one use Environment.Exit to terminate a console application?
body: <p>I'm maintaining a number of console applications at work and one thing I've been noticing in a number of them is that they call Environment.Exit(0).</p>
  
  <p>A sample program would look like this:</p>
  
  <pre><code>public class Program
  {
      public static void Main(string[] args)
      {
          DoStuff();
          Environment.Exit(0);
      }
  }
  </code></pre>
  
  <p>I don't understand what the intent of the original programmer was in doing this? In my mind even without the Environment.Exit statement the program should exit just fine. That said, for one of these programs, it's console window has been remaining even after it was supposed to have closed so I'm really not sure what's going on there....</p>
  
  <p>Am I missing something here? Or is there a reason why Environment.Exit should be called in this instance?</p>