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.

Revisions

  1. FoC- created this gist Jul 1, 2014.
    17 changes: 17 additions & 0 deletions gistfile1.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    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;
    }