Boardy
Boardy

Reputation: 36205

Accept input on 1 key press instead of waiting for user to press enter on Console.ReadLine()

I am working on a c# Console Application where the user has to only enter a number to make a selection. Instead of making the user have to type in the number and then hit enter is there a way for the input to be accept on just the number not being inputted, i.e. so the user doesn't have to press enter.e

Thanks for your help.

Upvotes: 1

Views: 270

Answers (2)

Volker Mauel
Volker Mauel

Reputation: 522

Console.ReadKey() should work in this case

Upvotes: 5

J. Holmes
J. Holmes

Reputation: 18546

Console.ReadKey()

Upvotes: 7

Related Questions