Wednesday, September 13, 2017

Console.ReadKey(true); versus Console.ReadLine();

Getting back into console apps in Visual Studio 2015, Console.ReadLine() now, no longer, seems to react to any key being pushed in the same way. Basically you proceed if you press Enter, but if you just type copy the copy appears right there in the console. Console.ReadKey(true) hides what you type in contrast and you go forward no matter what you tap on the keyboard so a "press any key" instruction better fits to this. Wait! This is not true at all. The Console.ReadKey(true) approach does not react to the press of the Enter key after all. Yeesh. So much for the "press any key" instructions. Wait again! The return key for Console.ReadKey(true) is only sabotaged for me in this fringe scenario.

No comments:

Post a Comment