- Multi-threads timers: System.Threading.Timer and System.Timers.Timer (.net framework):
App will handle timer event on a thread pool thread. Timers.Timer is a wrapper for Threading.Timer. They are used for doing time-consuming tasks.
If a is used in a WPF application, it is worth noting that the runs on a different thread then the user interface (UI) thread.
In order to access objects on the user interface (UI) thread, it is necessary to post the operation onto the of the user interface (UI) thread using or
.
Reasons for using a DispatcherTimer opposed to a are that theDispatcherTimer runs on the same thread as the and a
can be set on the DispatcherTimer.
- Single-thread timers: System.Windows.Forms.Timer(Windows Forms Timer)and System.Windows.Threading.DispatcherTimer(WPF timer)
used for small tasks such as updating UI.