title: Dynamic Where for List<T>
body: <p>I'm trying to create a dynamic filter for various classes.  We would only know at runtime what type we're dealing with. I need the ColumnName to be the actual column (not a string value).  </p>
  
  <p>Is there an easy way to convert the string into a column?       </p>
  
  <pre><code>public static List&lt;T&gt; Filter&lt;T&gt;
      (this List&lt;T&gt; Source, string ColumnName, 
      string TypeOfCompare, string CompValue)
  {
      IQueryable&lt;T&gt; matches = Source.AsQueryable();
  
      if (ColumnName.Length &gt; 0)
      {
          matches = (IEnumerable)matches.Where(a =&gt; ColumnName == CompValue)
      }
  
      List&lt;T&gt; ReturnList2 = new List&lt;T&gt;();
      ReturnList2 = matches.ToList();
      return ReturnList2;
  }
  </code></pre>