Create a gist now

Instantly share code, notes, and snippets.

Stopwatch wrapper
private T with_timer<T>(Func<T> action)
Stopwatch sw = Stopwatch.StartNew();
var result = action();
TimeSpan time = sw.Elapsed;
System.Console.WriteLine("Time: {0:00}:{1:00}:{2:00}.{3:000}", time.Hours, time.Minutes, time.Seconds, time.Milliseconds);
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment