LINQ - Get list of value starting with specific characters

it is a group by case

give try at:

Assign activity:
dtResult = dt_InputFile.Clone

Assign Activity:
dtResult =
(From d in dt_InputFile.AsEnumerable
Group d by k=d(“A”).toString.Trim into grp=Group
Let bc = String.Join(“,”, grp.Select(Function (x) x(“B”).toString.Trim))
Let ra = new Object() {k,bc}
Select r = dtResult.Rows.Add(ra)).CopyToDataTable

Another option could be to get a dictionary where key is A and Value the B groupmembers as list

dictLK | Dictionary (of String, List(ofString)) =
(From d in dt_InputFile.AsEnumerable
Group d by k=d(“A”).toString.Trim into grp=Group
Let bl = grp.Select(Function (x) x(“B”).toString.Trim).toList
Select t = Tuple.Create(k, bl)).ToDictionary(Function (t) t.Item1, Function(t) t.Item2)

1 Like