title: Pass a Function with multiple parameters as a Parameter
body: <p>I have this piece of code, that takes a single function with no parameter, and return's its runtime.</p>
  
  <pre><code>public static Stopwatch With_StopWatch(Action action)
  {
      var stopwatch = Stopwatch.StartNew();
      action();
      stopwatch.Stop();
      return stopwatch;
  }
  </code></pre>
  
  <p>I would like to transform it to take non void functions with parameters.
  I heard about the Func&lt;> delegate, but I have no idea how to use it.
  And I need something like this (very pseudo) : </p>
  
  <pre><code>   public T measureThis(ref Stopwatch sw, TheFunctionToMeasure(parameterA,parameterB))
     {
         sw.Start(); // start stopwatch
         T returnVal = TheFunctionToMeasure(A,B); // call the func with the parameters
         stopwatch.Stop(); // stop sw
         return returnVal; // return my func's return val
     }
  </code></pre>
  
  <p><em>So I have to get the return value of the passed func, AND get the stopwatch in the end.</em>
  Any help is greatly appreciated!</p>