C# - Timers from different namespaces and use tips

We have discussed timers, see the post 

 

zz - reprint of Comparing the Timer Classes in the .NET Framework Class Library

 

C# have provided four kinds of timers for user to use.

 

They are in the following namspaces.

 

 

  • System.Timers.Timer
  • System.Threading.Timer
  • System.Windows.Forms.Timer
  • System.Windows.Timer

How to specify infinite timeout value. You can specify infinite timeout value as follow.

m_threadTimer = new System.Threading.Timer(StartFieldSubscribeCallback, null, Timeout.Infinite, Timeout.Infinite); 
So the key is the System.Threading.Timeout, which has a Infinite number, (its real value is -1);

你可能感兴趣的:(C#)