I have a list of items with a property code and I want to group by eventId and create a table representation where code values are transformed to columns. Every triple (event, code,amount) is unique.
I want to transform this
eventId code  amount  
  1      A     100
  1      B     101
  1      C     102
  2      A     103
  2      C     104
  3      B     105
  ....
to this
eventId  A    B   C
 1      100  101 102
 2      103   0  104
 3       0   105  0
 ... 
var table=from x in list
    group x by x.eventId into gr
    select new
           {
              eventId=gr.Key,
              ....
           }
 
     
    
