Continuously Running Timer in C#

Continuously Running Timer in C#

using System;
using System.Timers;
public class Demo {
   private static Timer timer1;

   public static void Main() {
      timer1 = new System.Timers.Timer();
      timer1.Interval = 5000;
      timer1.Elapsed += OnTimedEvent;
      timer1.AutoReset = true;
      timer1.Enabled = true;
      Console.WriteLine("Press the Enter key to exit anytime... ");
      Console.ReadLine();
   }

   private static void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e) {
      Console.WriteLine("Raised: {0}", e.SignalTime);
   }
}