Compare list of values to datatow


Can anyone help me on how to compare the elements of a list to each value of data row and output the elements that did not match into a datatable?

Usecase: I have a List<string> and I have a DataTable (Dt)

One of the columns in a DataRow is ID.

I want to return items from the List that are not in present in the Column ID of the DataTable.

yourList.Except((From x In yourDT.AsEnumerable Let ID = x.Item(“ID”).ToString Select ID)).ToList

1 Like

Thank you. Worked like a charm!

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