StopWatch (System.Diagnostics) and System.Timers
The System.Diagnostics namespace provides classes that allow you to interact with system processes, event logs, and performance counters.
The System.Timers namespace provides a Timer component that allows you to raise an event by a specified interval.
source to share
Be careful with System.Timers.
In .Net
there are three timers.System.Timers.Timer
System.Threading.Timer
System.Windows.Forms.Timer
Three timers are available in .Net
The key point to look out for is the collection issue.
If your thread does not refer to an object after a certain point, it might get garbage collected. This is actually one of the key reasons for the IDisposable pattern, because calling dispose means that you keep the object until you reach the end of the dispose () call. This is the method called when you say
using(var myobj = new System.Threading.Timers())
{
//run program here
} //Timer can be collected from now.
source to share
As another option, I have used the BackgroundWorker class in my applications with good results
source to share