I read this excellent article Comparing the Timer Classes in the .NET Framework Class Library and came to the conclusion that anything I could do with Windows.Forms.Timer
I can do better with Timers.Timer
- and then some.
So the obvious question that comes to mind is: Why is the Windows.Forms
Timer offered at all?
Legacy (backward compatibility) support?
Other?
The main convenience of the Windows.Forms.Timer
is that its events are fired on the UI (Winforms) thread. If your timer events perform UI operations, it may be the simplest alternative (instead of calling Control.Invoke/BeginInvoke
or SynchronizationContext.Post/Send
inside all of your events).
The Windows.Forms.Timer
events get invoked on the UI thread so you can update the UI from the event handlers directly, which is not normally the case with Timers.Timer
(as you would get cross thread access violation exceptions).
And, as @Robert Harvey answered, it also has designer support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With