I have a console application,when I use Console.ReadLine()
,the application will show "Hello World".why Console.ReadKey()
can't?`
static void Main(string[] args)
{
System.Timers.Timer timer = new System.Timers.Timer(1000);
timer.Elapsed += timer_Elapsed;
timer.Enabled = true;
Console.ReadKey();// When use ReadLine() work fine;
}
static void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
Console.WriteLine("Hello World");
}