how to detect witch key is pressed with console.readkey | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to detect witch key is pressed with console.readkey

please help

8th Nov 2016, 8:40 AM
Ronny Kutzner
Ronny Kutzner - avatar
2 Answers
0
You can use the Console.ReadKey(true).Key property to read the pressed key. Add the following code to your Main method: Console.WriteLine("Please press a key: "); string a = Console.ReadKey(true).Key.ToString(); Console.WriteLine("\nYou pressed [ {0} ] key.", a);
8th Nov 2016, 11:25 AM
Andrei Dragomir
0
wow thank you that you take the time :3 its really helped me
8th Nov 2016, 12:02 PM
Ronny Kutzner
Ronny Kutzner - avatar