Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Stopwatch stopWatch = new Stopwatch();
  2. stopWatch.Start();
  3. Thread.Sleep(10000);
  4. stopWatch.Stop();
  5. // Get the elapsed time as a TimeSpan value.
  6. TimeSpan ts = stopWatch.Elapsed;
  7.  
  8. // Format and display the TimeSpan value.
  9. string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
  10. ts.Hours, ts.Minutes, ts.Seconds,
  11. ts.Milliseconds / 10);
  12. Console.WriteLine("RunTime " + elapsedTime);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement