luni, 25 august 2014

Stopwatch C# Example

Stopwatch measures elapsed time.

The Stopwatch measures elapsed time by counting timer ticks in the timer mechanism. If the installed hardware and operating system support a high-resolution performance counter, then the Stopwatch class uses that counter to measure elapsed time. 

Example:

Stopwatch sw = new Stopwatch();
sw.Start();
Thread.Sleep(500);
sw.Stop();
TimeSpan ts = sw.Elapsed;
MessageBox.Show("Elapsed time " + ts.ToString());

Niciun comentariu:

Trimiteți un comentariu