Created
July 1, 2014 16:30
-
-
Save FoC-/629965f5dff3d36cd135 to your computer and use it in GitHub Desktop.
Mesure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private T Mesure<T>(Func<T> func, out TimeSpan time) | |
{ | |
var stopwatch = new Stopwatch(); | |
stopwatch.Start(); | |
var result = func(); | |
stopwatch.Stop(); | |
time = stopwatch.Elapsed; | |
return result; | |
} | |
private void Mesure(Action func, out TimeSpan time) | |
{ | |
var stopwatch = new Stopwatch(); | |
stopwatch.Start(); | |
func(); | |
stopwatch.Stop(); | |
time = stopwatch.Elapsed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment