title: Passing in a function as a function parameter
body: <p>I am trying to implement the trapezodial rule in c# as a function:</p>
  
  <pre><code>Int_a^b f(x) = (b-a) * [f(a) + f(b)] / 2 
  </code></pre>
  
  <p>Is there a feature in c# which allows me to write the function as such?</p>
  
  <pre><code>double integrate(double b, double a, function f)
  {
      return (b-a) * (f(a) + f(b)) / 2;
  }
  </code></pre>
  
  <p>Where <code>f</code> can be any polynomial expression defined inside another function, for example:</p>
  
  <pre><code>double f (double x)
  {
      return x*x + 2*x;
  }
  </code></pre>