title: C#, dynamic linq error No applicable method 'Contains' exists in type 'String'
body: <p>I have a list of objects like this (I am using .NET 3.5)</p>
  
  <pre><code>public class MyObjects
  {
      public object Name { get; set; }
      public bool Case { get; set; }
  }
  
  List&lt;MyObjects&gt; test = new List&lt;MyObjects&gt; { 
  
      new MyObjects { Name = "one" },
      new MyObjects { Name = "two" },
      new MyObjects { Name = "three" },
      new MyObjects { Name = "four" },
      new MyObjects { Name = "one1" },
      new MyObjects { Name = "two1" },
      new MyObjects { Name = "three1" },
      new MyObjects { Name = "four1" },
      new MyObjects { Name = "one2" },
      new MyObjects { Name = "two2" },
      new MyObjects { Name = "three2" },
      new MyObjects { Name = "four2" },
  };
  </code></pre>
  
  <p>Now I try to search in the list using Linq.
  This is working as expected</p>
  
  <pre><code>var tmp = test
      .Select(p =&gt; p.Name)
      .Where(x =&gt; x.ToString().Contains("One", StringComparison.InvariantCultureIgnoreCase))
      ;
  </code></pre>
  
  <p>Using Dynamic Linq, this also works as expected</p>
  
  <pre><code>var dtmp = test.AsQueryable()
      .Select(p =&gt; p.Name)
      .Where("ToString().Contains(@0)", "one")
      ;
  </code></pre>
  
  <p>However, when trying to use case (in)sensitive, the dynamic fails.</p>
  
  <pre><code>var dtmp2 = test.AsQueryable()
      .Select(p =&gt; p.Name)
      .Where("ToString().Contains(@0, @1)", "one", StringComparison.InvariantCultureIgnoreCase)
      ;
  </code></pre>
  
  <p>The error is</p>
  
  <pre><code>No applicable method 'Contains' exists in type 'String'
  </code></pre>
  
  <p>My first attempt was to write a Contains() extension like this</p>
  
  <pre><code>public static bool Contains(this string source, string toCheck, StringComparison comp)
  {
      return source.IndexOf(toCheck, comp) &gt;= 0;
  }
  </code></pre>
  
  <p>Appears that Dynamic Linq isn't aware of my extension. I discovered (according to this)
  <a href="https://social.msdn.microsoft.com/Forums/en-US/39763339-1700-486f-9800-badd257e921e/custom-extension-methods-and-dynamic-linq-dynamic-expression-api?forum=linqprojectgeneral" rel="nofollow noreferrer">https://social.msdn.microsoft.com/Forums/en-US/39763339-1700-486f-9800-badd257e921e/custom-extension-methods-and-dynamic-linq-dynamic-expression-api?forum=linqprojectgeneral</a> </p>
  
  <p>that Dynamic Linq cannot uses (static) extension very easily. </p>
  
  <p>So either:</p>
  
  <ol>
  <li><p>Transform extension in a normal method. However, how can I do this for every ToString(), is it possible or should I write a method in MyObject then use linq with specific objects ?</p></li>
  <li><p>Modify the Dynamic Library code to accept hard coded (my)static extensions.</p></li>
  <li><p>Other suggestions?</p></li>
  </ol>
  
  <p>Note: I could use a simple if/else for case sensitive with two dynamics but I prefer to solve the dynamic way since my app use some complex filtering.</p>
  
  <p>Thank you in advance,</p>