title: How can I make it possible to use a dynamic Lambda in Dynamic LINQ
body: <p>In my search for a expression parser, I found the <a href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx" rel="nofollow">Dynamic LINQ API</a>. I want to use this API for letting the end user specify some criteria for validation of the business objects.</p>
  
  <p>So my first attempt to use the library succeeds with the following Unit test</p>
  
  <pre><code>var x = Expression.Parameter(typeof(int), "x");
  var list = Expression.Parameter(typeof(List&lt;int&gt;), "list");
  var e = DynamicExpression.ParseLambda(new[] { x, list }, null, "list.Any(it == x)");
  var compiledExpression = e.Compile();
  
  var myList = new List&lt;int&gt; { 24, 46, 67, 78 };
  Assert.AreEqual(false, compiledExpression.DynamicInvoke(2, myList));
  Assert.AreEqual(true, compiledExpression.DynamicInvoke(24, myList));
  </code></pre>
  
  <p>However I want to have a slightly more complex syntax as I want to change this</p>
  
  <pre><code>list.Any(it == x)     // OK
  </code></pre>
  
  <p>into</p>
  
  <pre><code>list.Any(i =&gt; i == x) // Raises error: No property or field 'i' exists in type 'int'
  </code></pre>
  
  <p>The second syntax would however allow me to nest lambda's (which is my ultimate goal) like so:</p>
  
  <pre><code>list1.All(i =&gt; list2.Any(j =&gt; j == i))
  </code></pre>
  
  <p>Anyone know how to adjust Dynamic.cs to support this syntax?</p>