Console.ReadLine("Default Text Editable Text On Line&qu

本文关键字:Text Editable On Line qu ReadLine quot Console Default | 更新日期: 2023-09-27 18:20:58

有办法做到这一点吗?我想传递一些文本并将其显示在输入行上,而不是"输入您的姓名:<cursor>",而是"Enter your Name:Default Editable text<游标>"

Console.ReadLine("Default Text Editable Text On Line&qu

好的,找到了。对不起。

static void Main(string[] args)
{
    Console.Write("Your editable text:");
    SendKeys.SendWait("hello"); //hello text will be editable :)
    Console.ReadLine();
}

将默认值分配给字符串,并仅在用户输入内容时替换它。

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()