How to measure the time of our processes C #

Many times it is necessary to know the time that elapses between the beginning and end of our processes. That is why in this opportunity I present the following code that solves this problem in a very simple way.

Add :

using System.Diagnostics;

Stopwatch stopWatch = new Stopwatch();

stopWatch.Start();

//Your process

stopWatch.Stop();

MessageBox.Show("Process Completed in " + stopWatch.Elapsed.ToString(), "System message");

I hope it is of your use,

regards

También te podría gustar...

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *