C# Console - hide the input from console window while typing

后端 未结 5 1926
被撕碎了的回忆
被撕碎了的回忆 2021-01-01 18:56

I\'m using Console.ReadLineto read the input of the user. However, I want to hide/exclude the inputted text on the console screen while typing. For example, whe

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-01 19:39

    Console.ReadKey(true) hides the user key. I do not believe Console.Read() offers such a capability. If necessary you can sit in a loop reading keys one at a time until enter is pressed. See this link for an example.

提交回复
热议问题