Console.ReadLine() 接受一个字符并停止提示

Console.ReadLine() accept one char and stop prompt

在控制台应用程序中,
我用一个Console.Readline()来提示,
它仅用于获取一个int(1到5),
但是,您可以添加比必要更多的字符。

请问如何在我的控制台记录一个字符后停止提示?

你看到这个 underscore _ .
不想看了

编辑 2015 年 1 月 10 日晚上 10 点:

do
{
    string ChoixString = Console.ReadLine();
    Analyseur = int.TryParse(ChoixString, out ChoixInt);
} while (!Analyseur || ChoixInt <= 0 || ChoixInt >= 6);

最终目标:用户不能在提示中写入超过一个字符。

解决方案:

ConsoleKeyInfo ChoixKey = Console.ReadKey();
string ChoixString = ChoixKey.Key.ToString();
Analyseur = int.TryParse(ChoixString, out ChoixInt);    

感谢您的帮助。

使用这个:

Console.ReadKey();

只会读一个character/keypress