.NET 中的 Timer

     在.NET 的 Class library 中总共有三个Timer 类,分别是一下三个:

          System.Windows.Form.Timer

          System.Threading.Timer

          System.Timers.Timer

     System.Windows.Form.Timer 主要使用在WinForm的单线程环境中,它其实是调用的系统时钟,所有他并不是异步的,但是由于系统时钟的消息是要进入消息队列进行排队,所以不够精确。

     System.Timers.Timer 是Server-based 时钟,运行在一个多线程的环境中,而实际上是在Threadpool 上另起的一个线程,所以它也不是异步的,但是更精确。

     System.Threading.Timer 也运行在多线程环境中,其本身就是一种Threadpool的回调。

在实际使用中,推荐使用System.Timers.Timer

Code
原文地址:https://www.cnblogs.com/engine1984/p/1451345.html