I am working on a small part of my program, handling input, basically I have this little code:
bool Done = false;
while (!Done)
{
ConsoleKeyInfo key = Console.ReadKey(true);
if (key.Key == ConsoleKey.Enter)
{
}
}
The main problem is that the code will handle ReadKey even between actions.
So, if you have a menu in which you can press keys, and then it will say “you pressed: x”, if you press any buttons while it shows you this message, it ReadKey
already receives this new key.
So, I want to block any additional input until the user sees the menu again.
source
share