Skip to content

Instantly share code, notes, and snippets.

@FoC-
Created July 1, 2014 16:30
Show Gist options
  • Save FoC-/629965f5dff3d36cd135 to your computer and use it in GitHub Desktop.
Save FoC-/629965f5dff3d36cd135 to your computer and use it in GitHub Desktop.
Mesure
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