I am building an application which needs to call a certain API at specific times. I would like to set execution times for each of the calls, and have my execute function be called automatically when each call needs to execute. What’s the best way to do this?
I have thought about creating a new Timer for each new call that needs to be executed, with the timer’s only interval being set to its execution time. Is this a good way of achieving what I need or is there something more efficient?
That’s a reasonable approach for a small number of timers/threads. For a large number, you’d use one timer set to the greatest common denominator of the intervals and have it select the appropriate task (if any) to launch.
Using a Windows Scheduled Task is almost certainly overkill.