You might try below,
static void ReadUserData()
{
var info = Console.ReadKey();
if (info.Key == ConsoleKey.Escape)
{
Console.WriteLine("exit");
}
else
{
Console.WriteLine(string.Format("\nKey has been pressed : {0}", info.Key));
int n;
n = Int32.TryParse(Console.ReadLine(), out n) ? n : 0;
Console.WriteLine(n);
}
}
:)