实现Lambda中的"where in"子句?

Tou*_*ubi 4 .net c# lambda

我有一个表达式让我回头:

var UserNotificationIds = _notificationBidderRepos.All(u => u.BidderId == BidderId).Select(n =>n.BidderId);
Run Code Online (Sandbox Code Playgroud)

另一种结构具有通知和要求是过滤其中提供了Id的通知 UserNotificationIds

var AllNotifications = _notificationRepos.All(n => n.ExpiresAt > DateTime.UtcNow).ToList();
Run Code Online (Sandbox Code Playgroud)

我正在尝试以下代码来查询所有通知,但没有得到如何在我的表达式中强制"where in".

请帮忙

Das*_*ina 5

如果它是基于1 id选择的

selectAll.where(x => x.id == varId)
Run Code Online (Sandbox Code Playgroud)

如果传入多个ID,则需要使用.Contains().

selectAll.where(x => idList.contains(x.id))
Run Code Online (Sandbox Code Playgroud)