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();


//Your process


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

I hope it is of your use,


También te podría gustar...

Deja una respuesta

Tu dirección de correo electrónico no será publicada.