title: Pass property getter to linq expression function
body: <p>I'm trying to take a method and make it generic, and I'm a little stuck because the method uses Linq to look at elements.  Here's the example method:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private List&lt;int&gt; GetListFromIDS(string ids, IEnumerable&lt;SubSpace_Function&gt; data)
  {
      if (string.IsNullOrEmpty(ids))
          return null;
  
      var list = ids
          .Split(new char[] { ',' })
          .Where(x =&gt; !string.IsNullOrWhiteSpace(x))
          .Select(x =&gt; int.Parse(x.Trim()));
  
      return data
          .Where(x =&gt; list.Contains(x.Function_Id)))
          .Select(x =&gt; x.Function_Id)
          .ToList();
  }
  </code></pre>
  
  <p>The parts that change are the type (<code>SubSpace_Function</code>) and the property to lookup <code>Function_ID</code>.</p>
  
  <p>I know I can just change the <code>SubSpace_Function</code> part to <code>T</code> in the generic method signature, but since each type will have it's own property to lookup, I'm not sure how to 'pass' in something like <code>Function_Id</code>.</p>