Skip to content

Instantly share code, notes, and snippets.

@jasmin-mistry
Created September 22, 2022 21:24
Show Gist options
  • Save jasmin-mistry/7c28d25ad56c98033947bfb9381f6d52 to your computer and use it in GitHub Desktop.
Save jasmin-mistry/7c28d25ad56c98033947bfb9381f6d52 to your computer and use it in GitHub Desktop.
Stop Watch C#
using System.Diagnostics;
var stopWatch = new Stopwatch();
stopWatch.Start();
//Tasks.Run();
var ts = stopWatch.Elapsed;
// Format and display the TimeSpan value.
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:000}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds);
Console.WriteLine("RunTime " + elapsedTime);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment