Timers are a Changin' (Part 3)
In my last couple of articles, we saw the System.Windows.Forms.Timer and the System.Timers.Timer. Today, I shall look at the 3rd form of Timer in the .NET library, the System.Threading.Timer. I refer you again to the that very good article I mentioned a while back, Comparing the Timer Classes in the .NET Framework Class Library by Alex Calvo. Take a moment to read his section on System.Threading.Timer then come back and we will jump right into some code... using System.Threading; public partial class Form1 : Form { public Form1() { InitializeComponent(); timer1 = new System.Threading.Timer(new TimerCallback(timer_elapsed), null, 2000, 1000); } System.Threading.Timer timer1; private void timer_elapsed(object sender) { Console.WriteLine(DateTime.Now.ToString()); TimerEvent(DateTime.Now.ToString(), Thread.CurrentThread.GetHashCode().ToString()); } private delegat...