title: C# Hotkey to exit console application
body: <p>So i was searching a way to set a hotkey to be able to exit a console application.
  On my way i found this thread: <a href="https://stackoverflow.com/questions/3654787/global-hotkey-in-console-application">Global hotkey in console application</a>
  which helped me a lot.
  So basically i am setting a hotkey to exit my application. My code looks like this:</p>
  
  <pre><code>using System;
  using System.Windows.Forms;
  using System.Runtime.InteropServices;
  using System.Threading;
  
  namespace ConsoleHotKey
  {
    class Program
    {
      static void Main(string[] args)
      {
        HotKeyManager.RegisterHotKey(Keys.A, KeyModifiers.Alt);
        HotKeyManager.HotKeyPressed += new EventHandler&lt;HotKeyEventArgs&gt;(HotKeyManager_HotKeyPressed);
        Console.ReadLine();      
      }
  
      static void HotKeyManager_HotKeyPressed(object sender, HotKeyEventArgs e)
      {
        Environment.Exit(1);
      }
    }
  }
  </code></pre>
  
  <p>and my question is: Is it a good way to exit a console application like this?
  I found some poeple saying that it is not such a good way but i couldn't understand why.
  Can someone give me some clarifications please?</p>