I have a collection in which each each item has a property “ID”. There is a datatable which has a column “ID”.
If there is any value in collection that is not in the datatable, it needs to be removed.
Can it be done with LINQ or the collection needs to be iterated?
If you want a collection of DataRow’s:
else, if you need to filter the collection of your objects:
If you add a reference to System.Data.DataSetExtensions, you can shorten it: