I came across these two APIs to read input from user in a simple console application in C#:
System.Console.ReadLine()
System.Console.In.ReadLine()
Here is a small code snippet where I'm trying to leverage these two:
namespace StackOverflow
{
class Program
{
static void Main(string[] args)
{
var input1 = System.Console.ReadLine();
var input2 = System.Console.In.ReadLine();
}
}
}
When I run this program, the two lines of code are doing exactly the same thing i.e. whatever string I type on console is returned till the time I hit the return key. A quick googling fetched me only one link which differentiates between Console.Read and Console.ReadLine APIs. Can anyone help me in understanding the significance of these two separate APIs doing the same thing i.e. to receive user input?