How do you wait for input on the same Console.WriteLine() line?

后端 未结 2 1201
后悔当初
后悔当初 2020-12-30 18:37

I want to pose a question such as:

What is your name? Joe

How would I accomplish this using Console.WriteLine to also w

2条回答
  •  余生分开走
    2020-12-30 19:38

    Use Console.Write instead, so there's no newline written:

    Console.Write("What is your name? ");
    var name = Console.ReadLine();
    

提交回复
热议问题