title: A method to construct a contains lambda expression from a list of properties and values
body: <p>I am attempting to write a method that will construct a contains type lambda expression that I can tack on to my queries like <code>qry.Where(lambda)</code>.</p>
  
  <p>I am pretty new to expression trees and am running into trouble.
  Here is what I have so far:</p>
  
  <pre><code>        public static IQueryable&lt;T&gt; ContainsQuery&lt;T&gt;(IQueryable&lt;T&gt; query, IEnumerable&lt;string&gt; propertyNames, IEnumerable&lt;string&gt; propertyValues)
                  {
                      ParameterExpression e = Expression.Parameter(typeof(T), "e");
                      MethodInfo indexOf = typeof(string).GetMethod("IndexOf", new Type[] { typeof(string), typeof(StringComparison) });
  
                      foreach (var propertyName in propertyNames)
                      {
                          foreach (var propertyValue in propertyValues)
                          {
  
                          }
                      }
      ... 
  return query.Where(lambda);
                  }
  </code></pre>
  
  <p>I know that I need the case insensitive indexOf to do the comparison and I know that I need to loop for all the properties and all the values (think searching for one or more values in one or more columns of a table and returning the or'd result of all the combinations.</p>
  
  <p>I am just having trouble getting started constructing this. </p>