Concatenate column values where duplicates using linq

@qwerty1,

Follow this approach:

Full Solution:

Variables:

groupedData LINQ:

dtInput.AsEnumerable().GroupBy(Function(row) row("ID").ToString()).ToList()

Concat LINQ:

String.Join(" ", currentItem.Select(Function(row) row("Locale").ToString() & row("Number").ToString()))

Add Data Row–> Array Row:

New Object(){strValue,"J",currentItem.Key,currentItem.First()("Date"),currentItem.First()("Area")}

Input/Output:

This is a working solution. You can always make it more refine.

Thanks,
Ashok :slight_smile:

1 Like