C# Console ReadLine
Description
Console ReadLine
reads the next line of characters from
the standard input stream.
Syntax
Console.ReadLine
has the following syntax.
[HostProtectionAttribute(SecurityAction.LinkDemand, UI = true)]
public static string ReadLine()
Returns
Console.ReadLine
method returns The next line of characters from the input stream, or null if no more lines
are available.
Example
using System;//w w w . j a v a 2s . co m
public class Example
{
public static void Main()
{
string line;
Console.WriteLine("Enter one or more lines of text (press CTRL+Z to exit):");
Console.WriteLine();
do {
Console.Write(" ");
line = Console.ReadLine();
if (line != null)
Console.WriteLine(" " + line);
} while (line != null);
}
}