Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在类中使用 C# 在 Xamarin 中使用 Mono 构建控制台应用程序。我遇到了一个我似乎找不到任何解决方案的问题。
是否可以允许用户编辑用 编写的行Console.Write()?
Console.Write()
例如:
应用程序输出Edit: Hello并且在该文本中只能编辑“Hello”,并且当用户按下输入键时,它会将其保存在字符串中。
Edit: Hello
您可以设置光标位置:
Console.Write("Edit: _____"); Console.SetCursorPosition(6, Console.CursorTop); string text = Console.ReadLine();