title: How to work with Generic type members in extension method?
body: <p>I started this extension method for fun, but now I find myself stuck into it,</p>
  
  <p>Actually I want to create an extension method to extend LINQ, the method will look like this:</p>
  
  <pre><code>books.In(b =&gt; b.Id, 1,2,3,4,5);
  </code></pre>
  
  <p>It will return books with Id range in the second <code>params[]</code> ,</p>
  
  <p>It also could be done like this:</p>
  
  <pre><code>books.In(b =&gt; b.Title, "t1","t2","t3","t4","t5");
  </code></pre>
  
  <p>What I come up with is this method (I just knew about expression tree today!):</p>
  
  <pre><code> public static List&lt;TEntity&gt; In&lt;TEntity, TMember&gt;(this List&lt;TEntity&gt; list,
              Expression&lt;Func&lt;TEntity, TMember&gt;&gt; identifier, params TMember[] keys)
          {
              Type t = typeof(TEntity); //How to use reflection here?
  
              List&lt;TEntity&gt; myList = list.Where(m =&gt; keys.Contains(m.));
              return myList;
          }
  </code></pre>
  
  <p>my problem is how to access the generic class members: i.e. <code>m.Id</code> or <code>m.Title</code> from the <code>identifier</code> expression?
  Can I use reflection to make this happen?</p>