/ Published in: C#
1 of the 3 types of timers in the .net framework
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using System; using System.Timers; public class Program { private static System.Timers.Timer testTimer; public static void Main(string[] args) { testTimer.Interval = 5000; testTimer.Enabled = true; Console.WriteLine("Press the enter key to stop the timer"); Console.ReadLine(); } private static void OnTimerElapsed(object source, ElapsedEventArgs e) { Console.WriteLine("Timer elapsed at {0}", e.SignalTime); } }