I have an Windows Form application that call a method after a period of times, repeatedly. so I’m concern of CPU usage. I know two ways to do that:
1) Using Timer component
2) callingThread.Sleep(time) in a loop
So, which one is better? Which on uses CPU less or didn’t uses CPU ?
It doesn’t matter because even if you set the loop to 1ms you couldn’t really measure the CPU usage. It would be that low.
For reasons of reliability, maintainability and readability you should use a
System.Windows.Forms.Timer.