我发现问题
问题出在 MonoDevelop 上,它在控制台中运行良好。感谢您的帮助。
我正在使用 C# 控制台应用程序,并且我构建了一个简单的菜单,当要求用户输入时,它没有显示输入的第一个字符。
这是我的代码。
Console.Write("Input >");
string result = Console.ReadLine();
switch(result) {
case "1":
Console.WriteLine("1");
break;
case "2":
Console.WriteLine("2");
break;
default:
Console.WriteLine("Invalid");
break;
}
--EDIT-- 实际代码
Console.Write("\t\t\t+");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("-----------------------------");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("+");
Console.Write("\t\t\t|");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("---MENU----------------------");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("|");
Console.Write("\t\t\t|");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("------|1|-HELP MENU----------");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("|");
Console.Write("\t\t\t|");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("------|2|-INITIATE CHAT------");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("|");
Console.Write("\t\t\t|");
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("------|3|-CONFIGURATION -----");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("|");
Console.Write("\t\t\t+");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("-----------------------------");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("+");
Console.ForegroundColor = ConsoleColor.White;
string result = Console.ReadLine();
menuInput(result);