Skip to content

Instantly share code, notes, and snippets.

@nbxx
Created September 26, 2016 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbxx/7cf126b403d185c77b7c0e4bb77d8eb9 to your computer and use it in GitHub Desktop.
Save nbxx/7cf126b403d185c77b7c0e4bb77d8eb9 to your computer and use it in GitHub Desktop.
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
foreach (var item in collection)
{
DoSomething(item);
}
stopWatch.Stop();
// Get the elapsed time as a TimeSpan value.
TimeSpan ts = stopWatch.Elapsed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment