Mar*_*ins 10 .net c# console console-application
有没有办法实现这一目标?我想传递一些文本并让它出现在输入行 - 而不是" 输入你的名字:<游标> ",我想要" 输入你的名字:默认可编辑文本<游标> "
Mar*_*ins 13
好的,找到了.抱歉.
static void Main(string[] args)
{
Console.Write("Your editable text:");
SendKeys.SendWait("hello"); //hello text will be editable :)
Console.ReadLine();
}
Run Code Online (Sandbox Code Playgroud)
将默认值分配给您的字符串,并仅在用户输入内容时才替换它。
Dim name, s As String
name = "John"
Console.Write($"Enter your Name (hit <Enter> for ""{name}""): ")
s = Console.ReadLine()
If Trim(s) <> "" Then
name = s
End If
Console.WriteLine("Result = {0}", name)
Console.ReadKey()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5958 次 |
最近记录: |