title: Linq GroupBy and multiple columns
body: <pre><code>class ExpenseClaim
  {
      int EmployeeId;
      int Team;
      double Cost;
  }
  
  
  List&lt;EmployeeExpense&gt; GetEmployeeExpenses()
  {
      return _expenseClaims // `_expenseClaims` is `List&lt;ExpenseClaim&gt;`
               .GroupBy(e =&gt; e.EmployeeId)
               .Select(x =&gt;
                  new EmployeeExpense(
                          x.Key,
                          // TODO: employee team?
                          x.Sum(e =&gt; e.Cost)
                  );
  }
  </code></pre>
  
  <p>Excuse the rather contrived example.  </p>
  
  <p>How do I get the employee team in <code>GetEmployeeExpenses</code>? I'm assuming I need a second group by but I can't work out the syntax. </p>
  
  <p>Note that for a given employee, their <code>Team</code> will always be the same anyway, so I'd be happy to take the <code>Team</code> of for example the first grouped by record.</p>
  
  <p>so...</p>
  
  <pre><code>ExpenseClaim { EmployeeId = 1, Team = Sales, Cost = 100 }
  ExpenseClaim { EmployeeId = 1, Team = Sales, Cost = 50 }
  
  =&gt;
  
  EmployeeExpense { EmployeeId = 1, Team = Sales, Cost = 150 }
  </code></pre>