I asked this question because I was interested in implementing a periodic timer that would give me better granularity than the timers supplied with .NET. My research on these timers ( Windows.Forms.Timer , System.Timers.Timer and System.Threading.Timer ) shows that the best I can hope for is granularity of 15 ms and an accuracy of -1 to +30 ms. This is good for most applications, but not for the application I was working on.
For more information on my research, see Why are .NET timers limited to 15ms? and http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=815 .
This led me to search for periodic timer objects available under Windows. I have identified five types that I posted in the original question. I have not found others. I dropped the Windows timer in the old style because I don't want to process messages. Then I wrote managed prototypes in C # for the other four types of timers and did some testing.
All four types of timers (multimedia timers, expected timers, timer queue timers, and Threadpool timers) give a reliable 1 ms interval with very good resolution. Of these, the Threadpool timer is by far the easiest to interact with, but, unfortunately, it is not supported in Windows XP. Timer queue timers have a dizzying set of parameters, but if you ignore most parameters, they are almost as simple as Threadpool timers. For more information, see Exploring Best Timer Options .
I decided to wrap a timer queue timer for my generic timer class in .NET. You can see it here .
You may also be interested in Expected Timers in .NET with C # .
source share