title: LINQ GroupBy by Anonymous Object Not actually grouping
body: <p>I am wondering why my LINQ GroupBy statement isn't actually grouping my set of objects correctly. I still get all the objects I started out with even though they share the same Key.</p>
  
  <p>here is the code that I have tried:</p>
  
  <pre><code>var snapshot = snapshotService.GetSnapshot(siids, warehouseId)
     .GroupBy(a =&gt; new
     {
        a.SIId,
        a.WarehouseId,
        a.Treatment,
        a.UnitOfMeasure
     })
     .Select(a =&gt; new Snapshot
     {
        SIId = a.Key.SIId,
        WarehouseId = a.Key.WarehouseId,
        Treatment = a.Key.Treatment,
        UnitOfMeasure = a.Key.UnitOfMeasure,
        TotalAmount = a.Sum(sum =&gt; sum.TotalAmount),
        Available = a.Sum(sum =&gt; sum.Available),
        Unavailable = a.Sum(sum =&gt; sum.Unavailable)
     }).ToList();
  </code></pre>
  
  <p>The Key is SIId, WarehouseId, Treatment, and UnitOfMeasure. I would like one return set for every key combination. I instead am getting multiple return sets for every key combination and it is so annoying! There are different values for TotalAmount, Available, and Unavailable as well. It's almost as if the GroupBy statement is getting completely annoyed.</p>
  
  <p>For example: If I have an objects</p>
  
  <pre><code>{SIId = 1, WareHouseId = 1, Treatment = 1, UnitOfMeasure = 1,
    TotalAmount = 1, Available = 1, Unavailable = 1}
  {SIId = 1, WareHouseId = 1, Treatment = 1, UnitOfMeasure = 1,
    TotalAmount = 2, Available = 2, Unavailable = 2}
  </code></pre>
  
  <p>I would expect the return to be:</p>
  
  <pre><code>{SIId = 1, WareHouseId = 1, Treatment = 1, UnitOfMeasure = 1,
    TotalAmount = 3, Available = 3, Unavailable = 3}
  </code></pre>
  
  <p>However I am getting the composite list</p>
  
  <pre><code>{
    {SIId = 1, WareHouseId = 1, Treatment = 1, UnitOfMeasure = 1,
      TotalAmount = 1, Available = 1, Unavailable = 1},
    {SIId = 1, WareHouseId = 1, Treatment = 1, UnitOfMeasure = 1,
      TotalAmount = 2, Available = 2, Unavailable = 2}
  }.
  </code></pre>
  
  <p>What gives?</p>