title: Where clause using a lambda property selector
body: <p>I want to be able to refresh an object by finding it's match in list of objects that I've got back from the database.  I can do it with reflection - but am sure there must be a way of getting the Property Selector within a Where clause.</p>
  
  <p>This is the kind of thing I want to call ...</p>
  
  <pre><code>MyObject = GetRefreshedObject(MyObject, RefreshedObjects, () =&gt; ID);
  </code></pre>
  
  <p>But I'm a bit stuck with the Method!</p>
  
  <pre><code>    public static TE GetRefreshed&lt;TE, P&gt;(TE entity, IEnumerable&lt;TE&gt; refreshed, Expression&lt;Func&lt;TE, P&gt;&gt; selector) where TE : class
      {
          if (entity == null) return null;
  
          return refreshed.Where(x =&gt; x.[Selector == entity.Selector]).FirstOfDefault();
  
          //The square bracket bits obviously don't work but hopefully show what I'm trying to achieve!
  
      }
  </code></pre>