[Mono-list] Timer, possible bug?
Julio Jiménez
jujibo@inicia.es
Fri, 21 May 2004 11:39:42 +0200
why this little program never stop when timer is running?
using System;
using System.Timers;
public class Timer1
{
public static void Main()
{
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed+=new ElapsedEventHandler(OnTimedEvent);
// Set the Interval to 1 seconds.
aTimer.Interval=1000;
//aTimer.AutoReset = false;
//aTimer.Enabled=true;
aTimer.Start ();
Console.WriteLine("Testing Timer, interval = 1 second. Press
\'q\' to quit the sample.");
while(System.Console.Read()!='q');
}
// Specify what you want to happen when the Elapsed event is raised.
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Console.WriteLine("Hello World!");
}
}
I think System.Console.Read() never ends
regards
Julio Jiménez