title: C# Console.Readkey - wait for specific input
body: <p>I have a small C# console app I am writing.</p>
  
  <p>I would like the app to wait for instruction from the user regarding either a Y or a N keypress (if any other key is pressed the app ignores this and waits for either a Y or a N and then runs code dependent on the Y or N answer.</p>
  
  <p>I came up with this idea, </p>
  
  <pre><code>while (true)
  {
      ConsoleKeyInfo result = Console.ReadKey();
      if ((result.KeyChar == "Y") || (result.KeyChar == "y"))
      {
           Console.WriteLine("I'll now do stuff.");
           break;
      }
      else if ((result.KeyChar == "N") || (result.KeyChar == "n"))
      {
          Console.WriteLine("I wont do anything");
          break;
      }
  }
  </code></pre>
  
  <p>Sadly though VS says its doesnt like the result.Keychat == as the operand cant be applied to a 'char' or 'string'</p>
  
  <p>Any help please?</p>
  
  <p>Thanks in advance.</p>