C# Why are timer frequencies extremely off?
问题 Both System.Timers.Timer and System.Threading.Timer fire at intervals that are considerable different from the requested ones. For example: new System.Timers.Timer(1000d / 20); yields a timer that fires 16 times per second, not 20. To be sure that there are no side-effects from too long event handlers, I wrote this little test program: int[] frequencies = { 5, 10, 15, 20, 30, 50, 75, 100, 200, 500 }; // Test System.Timers.Timer foreach (int frequency in frequencies) { int count = 0; //