Which Timer object should I use in long running processes in .Net?
The timer will be used in a Windows Service, and I wish to find the best fit performance wise.
Which Timer object should I use in long running processes in .Net?
The timer will be used in a Windows Service, and I wish to find the best fit performance wise.
I like System.Timers.Timer best for server stuff, since it raises an event and has support for manual reset (ie, you can prevent it from firing again until you're done processing the elapsed event). System.Threading.Timers doesn't support manual reset- it just fires on the interval, which is good for some things, bad for others. System.Timers.Timer gives you the choice. The other timer types aren't suitable for service work.
Perf-wise, the choice between those two is pretty negligible.