title: LINQ Group-by with complete object access
body: <p>What I want is better explained with code. I have this query:</p>
  
  <pre><code>var items = context.Items.GroupBy(g =&gt; new {g.Name, g.Model})
                  .Where(/*...*/) 
                  .Select(i =&gt; new ItemModel{
                                  Name=g.Key.Name,
                                  SerialNumber = g.FirstOrDefault().SerialNumber //&lt;-- here
                                       });
  </code></pre>
  
  <p>Is there a better way to get the serial number or some other property that is not used in the key? The only way I could think of is to use FirstOrDefault.</p>