System.Timers.Timer vs System.Threading.Timer

后端 未结 8 2051
情书的邮戳
情书的邮戳 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 08:12

    In his book "CLR Via C#", Jeff Ritcher discourages using System.Timers.Timer, this timer is derived from System.ComponentModel.Component, allowing it to be used in design surface of Visual Studio. So that it would be only useful if you want a timer on a design surface.

    He prefers to use System.Threading.Timer for background tasks on a thread pool thread.

提交回复
热议问题