Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/articles/c-sharp-tutorials/)
-   -   Difference between System.Windows.Forms.Timer and System.Timers.Timer (http://www.go4expert.com/articles/difference-systemwindowsformstimer-t2122/)

shabbir 4Dec2006 16:52

Difference between System.Windows.Forms.Timer and System.Timers.Timer
 

System.Windows.Forms.Timer



1. It's a forms-based timer.

2. After creating it, you can set the interval which elapses between ticks using the Interval and hook up a delegate to its Tick event.

3. Calling Start and Stop methods, start and stop of the timer.

4. It runs entirely on the UI thread, So some of the UI related operations is to be done in this timers.

5. Long UI operation may result in loosing some ticks

System.Timers.Timer



1. Instead of a Tick event, it has the Elapsed event.

2. As before, 3. Calling Start and Stop methods, start and stop of the timer.

3. The AutoReset property determines whether or not the timer should fire the event once and then stop, or keep going in a fire event / wait cycle. System.Windows.Forms.Timer does not have this property

4. Setting the synchronizing object to a UI control makes the event fire on that control's UI thread.


All times are GMT +5.5. The time now is 18:20.