KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a very long list of Ids (integers) that represents all the items that are currently in my database: var idList = GetAllIds(); I also have another huge generic list with items to add to the database: List<T> itemsToAdd; Now, I would like to remove all items from the generic list whose Id is already in the idList. Currently idList is a simple array and I subtract the lists like this: itemsToAdd.RemoveAll(e => idList.Contains(e.Id)); I am pretty sure that it could be a lot faster, so what datatypes should I use for both collections and what is the most efficient practice to subtract them? Thank you!
Tags (comma-separated)
Save Edits
Cancel