title: Convert lambda with any | contains to expression tree
body: <p>How can the following simple lambda be represented using Expression Tree syntax?</p>
  
  <pre><code>v.Tags.Any(t =&gt; searchTags.Contains(t.ID));
  </code></pre>
  
  <p>Where :</p>
  
  <ul>
  <li>searchTags = List of long</li>
  <li>v = Class with Tags navigational property </li>
  <li>t = Tag class with ID property</li>
  </ul>
  
  <p>Variations on the following have been tried:</p>
  
  <pre><code> var anyInfo = typeof(Queryable).GetMethods()
           .Where(m =&gt; m.Name == "Any")
           .Single(m =&gt; m.GetParameters().Length == 2)
           .MakeGenericMethod(typeof(Tag));
  
  
   var toQueryable = typeof(Queryable).GetMethods()
           .Where(m =&gt; m.Name == "AsQueryable")
           .Single(m =&gt; m.IsGenericMethod)
           .MakeGenericMethod(typeof(Tag));
  
   var containsInfo = typeof(List&lt;long&gt;).GetMethod("Contains", new Type[] { typeof(long) });
  
   var list = Expression.Constant(searchTags);
   var mcvalue = Expression.Property(v, "Tags");
   ParameterExpression tagParam = Expression.Parameter(typeof(Tag), "mt");
  
   var tagID = Expression.Property(tagParam, "ID");
   var st = Expression.Call(list, containsInfo, tagID);
   return Expression.Call(null, anyInfo, Expression.Call(null, toQueryable, mcvalue), st);
  </code></pre>