Pavel Minaev
7/23/2008 9:46:00 AM
On Jul 23, 1:11 pm, Chris Marsh <ChrisMa...@discussions.microsoft.com>
wrote:
> All
>
> I have a MonitorClient class, which will control a number of monitor classes
> implementing an IMonitor interface. These monitor classes will monitor
> various different things on a server. Each monitor class will have a
> differently timed cycle on which to perform its probing.
>
> My question is: which Timer class woudl it be better to use within the
> monitor classes - System.Threading.Timer, or System.Timers.Timer? I've read
> up on both, but cannot really see which suits my requirements better. Both
> seem to use a new worker thread from the CLR thread pool on which to raise
> their events, so I cannot immediately see a benefit to using one or the other
> for my particular scenario.
The only difference between the two I'm aware of is that Timers.Timer
is a component (and thus can be manupulated with the visual designer),
and that it has SynchronizationObject property. The latter technically
allows it to raise events on some specific thread, rather than on a
new threadpool thread. If you do not need either of those, then you'll
probably want to stick with Threading.Timer.