title: How do I create an expression tree to represent 'String.Contains("term")' in C#?
body: <p>I am just getting started with expression trees so I hope this makes sense. I am trying to create an expression tree to represent:</p>
  
  <pre><code>t =&gt; t.SomeProperty.Contains("stringValue");
  </code></pre>
  
  <p>So far I have got:</p>
  
  <pre><code>    private static Expression.Lambda&lt;Func&lt;string, bool&gt;&gt; GetContainsExpression&lt;T&gt;(string propertyName, string propertyValue)
      {
          var parameterExp = Expression.Parameter(typeof(T), "type");
          var propertyExp = Expression.Property(parameter, propertyName);
          var containsMethodExp = Expression.*SomeMemberReferenceFunction*("Contains", propertyExp) //this is where I got lost, obviously :)
          ...
          return Expression.Lambda&lt;Func&lt;string, bool&gt;&gt;(containsMethodExp, parameterExp); //then something like this
      }
  </code></pre>
  
  <p>I just don't know how to reference the String.Contains() method.</p>
  
  <p>Help appreciated. </p>