title: Pivot data using LINQ
body: <p>I have a collection of items that contain an Enum (TypeCode) and a User object, and I need to flatten it out to show in a grid.  It's hard to explain, so let me show a quick example.</p>
  
  <p>Collection has items like so:</p>
  
  <pre><code>TypeCode | User 
  ---------------
  1        | Don Smith  
  1        | Mike Jones  
  1        | James Ray  
  2        | Tom Rizzo  
  2        | Alex Homes  
  3        | Andy Bates  
  </code></pre>
  
  <p>I need the output to be:</p>
  
  <pre><code>1          | 2          | 3  
  Don Smith  | Tom Rizzo  | Andy Bates  
  Mike Jones | Alex Homes |  
  James Ray  |            |  
  </code></pre>
  
  <p>I've tried doing this using foreach, but I can't do it that way because I'd be inserting new items to the collection in the foreach, causing an error.</p>
  
  <p>Can this be done in Linq in a cleaner fashion?</p>