I have a DataTable
containing a list of Id's I get from the DB. What I need to do is get a List<Of Integer>
.
This list of integers will be the Id's in the DataTable
, but I need to filter them based on another List<Of Integers>
. So I'm basically trying to generate a list of Id's from the DataTable
but only if they exist in my other list of Ids.
I know how to do the Linq To DataSet query, but I'm just not sure if it's possible to filter it based on another List, here's some pseudo code to explain what I'm trying to achieve:
List<Of Integer> ExistingList = GetReferenceIds(whatever)
DataTable DBTable = GetAllDatabaseIds(whatever)
List<Of Integer> FilteredList = DBTable.AsEnumerable()
.Where(Column("Id") IN FilteredList).ToList()
Is there an easy way to do this without having to enumerate through the list and check each one?