Console.ReadKey()
- Admin
- Jun 8, 2024
- 1 min read
Generalley this command is used for terminating the session. It asks to user to input any key.
Console.WriteLine("press a button:");ConsoleKeyInfo pbutton = Console.ReadKey();Console.WriteLine();Console.WriteLine("the pressed button: " + pbutton.KeyChar);Console.WriteLine("Press any key to terminate session:");Console.ReadKey();Output
press a button:
a
the pressed button: a
Press any key to terminate session:

Comments