I have the following populated lists:
List<Item> Items
List<long> QueueID
Where Item is this:
public Class Item
{
long QueueID
....
}
I need to make a new List of Items that excludes Items with QueueIDs that are in the other List.
I'm trying this but the compiler doesn't like it.
var result = Items.Where(x => !QueueID.Exists(x => x.QueueID));
您可以通过List.Contains
使用此方法:
List<Item> resultList = Items.Where(x => !QueueID.Contains(x.QueueID)).ToList();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.