简体   繁体   English

如何隐藏Console.ReadKey()用户输入?

[英]How to hide Console.ReadKey() user input?

I'm making a Fahrenheit to Celsius converter (a very simple one, because I'm very new) and when I use Console.ReadKey() it displays the character the user pressed to the screen. 我正在制作华氏温度转换器(一个非常简单的转换器,因为我很新),当我使用Console.ReadKey()它会显示用户按下屏幕的字符。 Is there a way to hide the user input? 有没有办法隐藏用户输入?

cki = Console.ReadKey();

There is an overload ReadKey(bool) which determines whether or not to hide the character. 有一个重载ReadKey(bool) ,它决定是否隐藏字符。 So you want: 所以你要:

cki = Console.ReadKey(true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM