Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>Times the execution of a function and outputs both the elapsed time and the function's result.</summary>
- static void Time<T>(Func<T> work)
- {
- var sw = Stopwatch.StartNew();
- var result = work();
- Console.WriteLine(sw.Elapsed + ": " + result);
- }
Advertisement
Add Comment
Please, Sign In to add comment