xxxxxxxxxx
Console.ReadLine(); ??????
Reads the next line of characters from the standard input stream.
One of the most common uses of the ReadLine method is to pause program
execution before clearing the console and displaying new information to
it, or to prompt the user to press the Enter key before terminating the
application.
xxxxxxxxxx
Console.WriteLine("Enter your name: ");
name = Console.ReadLine();
xxxxxxxxxx
// "Console.ReadLine()" is used to get user input
//for example
Console.WriteLine("What is your name?");
string Name = Console.ReadLine();
Console.WriteLine("Hello " + Name);
xxxxxxxxxx
// C# program to illustrate
// the use of Console.ReadLine()
// to pause the console
using System;
using System.IO;
class Geeks {
// Main Method
public static void Main()
{
string name;
int n;
Console.WriteLine("Enter your name: ");
// typecasting not needed as
// ReadLine returns string
name = Console.ReadLine();
Console.WriteLine("Hello " + name +
" Welcome to GeeksforGeeks!");
// Pauses the console until
// the user presses enter key
Console.ReadLine();
}
}