Console.ReadLine()

noun

say it: “KON-sohl REED-lyne” /ˈkɒnsoʊl ˈriːdlaɪn/

The C# method that waits for the user to type a line and press Enter, and returns that text.

What does Console.ReadLine() do in C#?

Console.ReadLine() — A method that reads one line of text from standard input.

class Registration
{
    string? ReadName()
    {
        return Console.ReadLine();
    }
}

In a sentence

  • “I used Console.ReadLine to ask the user for their name.”

Level: Apprentice · More C# terms at this level

Updated