Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window.
A ConsoleKeyInfo object that describes the ConsoleKey constant and Unicode character, if any, that correspond to the pressed console key. The ConsoleKeyInfo object also describes, in a bitwise combination of ConsoleModifiers values, whether one or more Shift, Alt, or Ctrl modifier keys was pressed simultaneously with the console key.
The Console.ReadKey method waits, that is, blocks on the thread issuing the Console.ReadKey method, until a character or function key is pressed. A character or function key can be pressed in combination with one or more Alt, Ctrl, or Shift modifier keys. However, pressing a modifier key by itself will not cause the Console.ReadKey method to return.
Depending on your application, you might want to use the Console.ReadKey method in conjunction with the Console.KeyAvailable property.
The Console.ReadKey method reads from the keyboard even if the standard input is redirected to a file with the Console.SetIn(System.IO.TextReader) method.