I want to use a timer that allows me to run a specific code at certain intervals but Winforms timer is very inaccurate. I set it to 2 seconds but it goes off as much as 48 seconds. The kind of code I am running is highly dependent on acting as soon as possible so 48 seconds is way too late to do anything.
Also I don't want the timer to eat a lot of CPU cycles because the code I am running is very simple.
Use the System.Timer Class. Since it's designed for multi-threaded environments it's more accurate than the timer control.