You only need to group by the ID of the row. Then, concatenate all the values in each group: from row in passedInTable.AsEnumerable() group row by row. Field("ID") into rowGroup select new { ID = rowGroup.
Key, Val1 = String. Join(" ", rowGroup. Select(row => row.
Field("Val1")).ToArray()), Val2 = String. Join(" ", rowGroup. Select(row => row.
Field("Val2")).ToArray()), }.
Very cool. Grouping was the key, plus I was trying to use Linq's aggregate method which apparently wasn't necessary. Thank ya sir!
– Carter Feb 19 '10 at 0:35 Aggregate would work here, String. Join just happens to be a specific implementation we can leverage :-) – Bryan Watts Feb 19 '10 at 0:42 Yeah, that's what I gathered. Might try to aggregate it just to see if I can.
– Carter Feb 19 '10 at 0:48.
God, Linq confuses me... I've found quite a few examples that do similar things to what I need, but I'm still getting all turned around. I want to use Linq to build a table where essentially in GroupedTable the IDs would become unique and values for duplicated IDs get concatenated into their respective rows. We'll call it GroupedTable.
I think I could see how I could do what I need at this point with some for looping but I'm pretty sure it's do-able via Linq. Especially based on all the examples I see out there, using .sum() for number types. I guess the ultimate question is, in that query up above, how do I aggregate the values for the val1 and val2 columns from within that select new block so it's selecting out the concatenated values.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.