Timer Class – Generates an event after a set interval, with an option to generate recurring events. This is easy to use, let’s see one simple example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | using System; using System.Timers; public class Program { public static void Main() { Timer timer = new Timer(200); timer.Elapsed += Timer_Elapsed; timer.Start(); while (true) { // Infinite loop. } } private static void Timer_Elapsed(object sender, ElapsedEventArgs e) { // Use SignalTime. DateTime time = e.SignalTime; Console.WriteLine("TIME: " + time); } |
The result is this:
| TIME: 9/2/2021 7:42:16 PM TIME: 9/2/2021 7:42:17 PM TIME: 9/2/2021 7:42:17 PM TIME: 9/2/2021 7:42:17 PM TIME: 9/2/2021 7:42:17 PM TIME: 9/2/2021 7:42:17 PM TIME: 9/2/2021 7:42:18 PM TIME: 9/2/2021 7:42:18 PM TIME: 9/2/2021 7:42:18 PM TIME: 9/2/2021 7:42:18 PM Fatal Error: Execution time limit was exceeded |
This : Fatal Error: Execution time limit was exceeded is a protected issue from This online tool comes with these restrictions: Currently… Read More »