Group a DataRow by all columns

Hello,

Could you please present any method to group a DataRow by all its columns ?

Thank you in advance.

We can start by:

TableList | List(of DataTable) =

(From d in dtDataVar.AsEnumerable
Let jk = String.Join("_", d.ItemArray.Select(Function (x) x.ToString.Trim))
Group d by k=jk into grp=Group
Select t = grp.CopyToDataTable).ToList

and will get a list of datatable, where each table represents a group with its members

Maybe you can elaborate more about your case with some sample data

Well one scenario could be removing dulplicate rows by avoiding the built-in activity.

what is meant in detail?

(From d in dtDataVar.AsEnumerable
Let jk = String.Join("_", d.ItemArray.Select(Function (x) x.ToString.Trim))
Group d by k=jk into grp=Group
Select r = grp.First()).CopyToDataTable

Perfect. Thank you @ppr.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.