System.Timers.Timer vs System.Threading.Timer

后端 未结 8 2032
情书的邮戳
情书的邮戳 2020-11-22 07:08

I have been checking out some of the possible timers lately, and System.Threading.Timer and System.Timers.Timer are the ones that look needful to me (since they support thre

8条回答
  •  眼角桃花
    2020-11-22 07:47

    This article offers a fairly comprehensive explanation:

    "Comparing the Timer Classes in the .NET Framework Class Library" - also available as a .chm file

    The specific difference appears to be that System.Timers.Timer is geared towards multithreaded applications and is therefore thread-safe via its SynchronizationObject property, whereas System.Threading.Timer is ironically not thread-safe out-of-the-box.

    I don't believe that there is a difference between the two as it pertains to how small your intervals can be.

提交回复
热议问题