If this is a console application, you should be looking at using the ConsoleKeyInfo.Key http://msdn.microsoft.com/en-us/library/system.consolekeyinfo.key%28v=vs.110%29.aspx property. Taken from the link provided, there is a sample from MSDN that shows a way to close/quit the console program when the esc key is pressed. Here is the basic idea:
public static void Main()
{
ConsoleKeyInfo cki;
Console.WriteLine("Press the Escape (Esc) key to quit: \n");
do
{
cki = Console.ReadKey();
// do something with each key press until escape key is pressed
} while (cki.Key != ConsoleKey.Escape);
}