title: Linq: Create logical inverse of expression
body: <p>I would like to create a method that accepts an <code>Expression&lt;Func&lt;T, bool&gt;&gt;</code> and creates the logical inverse of it (i.e. it would return <code>false</code> where it would have returned <code>true</code>, and vice versa. This is much harder than I thought. This is where I am up to:</p>
  
  <pre><code>public static Expression&lt;Func&lt;T, bool&gt;&gt; Not&lt;T&gt;(this Expression&lt;Func&lt;T, bool&gt;&gt; expression)
  {
    return Expression.Lambda&lt;Func&lt;T, bool&gt;&gt;(Expression.Not(expression.Body));
  }
  </code></pre>
  
  <p>This compiles fine but throws the following Exception when called:</p>
  
  <pre><code>Test method Tests.Common.Unit.LinqPredicateBuilderTests.CanInverseAPredicate threw exception: 
  System.ArgumentException: Incorrect number of parameters supplied for lambda declaration
  </code></pre>
  
  <p>I have no idea what I'm doing. Could anyone fill in the blanks?</p>