Skip to content

Console.ReadLine

Console.ReadLine reads a line of input and returns it as a string.

Console.Write("Enter text: ");
string input = Console.ReadLine();
Console.WriteLine($"You entered: {input}");
Terminal window
dotnet run
Terminal window
Enter text: test
You entered: test