title: Checking if any key pressed in console application C#
body: <p>I need to check if any key is pressed in a console application. The key can be any key in the keyboard. Something like:</p>
  
  <pre><code>if(keypressed)
  { 
  
  //Cleanup the resources used
  
  }
  </code></pre>
  
  <p>I had come up with this:</p>
  
  <pre><code>ConsoleKeyInfo cki;
  cki=Console.ReadKey();
  
  if(cki.Equals(cki))
  Console.WriteLine("key pressed");
  </code></pre>
  
  <p>It works well with all keys except modifier keys - how can I check these keys?</p>