using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace test1
{
class Program
{
static void Main(string[] args)
{

        char ch = (char)System.Console.Read();

        Console.WriteLine(ch);

        Console.Read();
    }
}

}

I usually use "Console.Read()" to pause the output screen. But i doesn't work when in a program already involving "Console.Read()". What's the justification for this?

The same thing happens with the above code

Call Main method in the end your program wil keep calling itself.

I want it to terminate after I press a key

Then do some flow control/use switch case and achive it

Just explain why this thing occurs?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.