title: C#, how do I close my app by pressing the "Enter" button?
body: <p>I'm new to C# and was wondering, if I wanted to close my app by pressing the Enter button how would I do so? After doing some research on this website the closest thing I found to doing the trick is this code, </p>
  
  <pre><code>  string key = Console.ReadKey().ToString();
    if (key == "")
    {
        Console.WriteLine("User pressed enter!");
        return;
    }
  </code></pre>
  
  <p>However, this doesn't do what I want it to. For this, if I press Enter it just takes to to the "press any button to close this app". If anyone could help that would be great.</p>
  
  <p>Thanks.</p>