Im having an issue doing something thats probably pretty simple.
My LINQ query is returning a result set of 10 objects.
Something like:
Name: Bill, Action: aaa, Id: 832758
Name: Tony, Action: aaa, Id: 82fd58
Name: Bill, Action: bbb, Id: 532758
Name: Tony, Action: bbb, Id: 42fd58
What I need to do, is to group these so that there are only 2 rows, ie one per Name, but have the ones with “Action: bbb” move into a different column. So the output would be:
Name: Bill, Action: aaa, Action_2: bbb, Id: 832758, Id_2: 532758
Name: Tony, Action: aaa, Action_2: bbb, Id: 82fd58, Id_2: 42fd58
Can anyone explain to me how I might do that?
Cheers
The query above assumes that you have only two rows for each name; if you have multiple rows per name, you can take the second
Action/Idvalue by using.Skip(1).Take(1)instead of.Last()