Reference:
http://www.cnblogs.com/ryhan/archive/2011/07/14/2106350.html
http://www.biye5u.com/article/Csharp/winform/2010/2813.html
在C#里现在有3个Timer类:
- System.Windows.Forms.Timer
- System.Threading.Timer
- System.Timers.Timer
System.Timers.Timer t = new System.Timers.Timer(10000); //实例化Timer类,设置间隔时间为10000毫秒;
t.Elapsed += new System.Timers.ElapsedEventHandler(theout); //到达时间的时候执行事件;
t.AutoReset = true; //设置是执行一次(false)还是一直执行(true);
t.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件;