I'm just beginning to learn C#, I'm trying to understand the working of Console.ReadLine()
Console.Read()
, while trying to understand how Console.Read()
works Im encountering the following issue. I tried executing the following program.`
enter cusing System;
namespace Variables
{
class Program
{
static void Main(string[] args)
{
Console.Write("Give me an input :");
Console.Read();
Console.Write("Give me an input :");
Console.Read();
}
}
In the console I'm able to give an input for the first Console.Read() statement, but where as for the later statement the program finishes its execution without even accepting the input. Please explain why the program terminates without accepting any input.