简体   繁体   中英

Linq any collection in any collection

Entity Framework

I have a simple object with a well know structure

Order.Name
Order.ProductIds  List<int>

I need to get all the Orders which include at least 1 productId found in searchProductIds:

List<int> searchProductIds

I'm trying:

queryOrders.Where(e=>e.ProductIds.Any(???searchProductIds???));

Perhaps some kind of intersect?

Thank you in advance

尝试这个:

queryOrders.Where(queryOrder => (queryOrder.ProductIds.Intersect(searchProductIds)).Any());

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM