C#のLinqにはSQLにあるINやNOT INの構文がありません。 他ライブラリを使用すればできるのかもしれませんが、とりあえず裸のLinqのみで実装する場合のやり方を記載します。
テストデータ
var shops = new[] { new Shop() {ShopId = 1, ShopName = "shop1"}, new Shop() {ShopId = 2, ShopName = "shop2"}, new Shop() {ShopId = 3, ShopName = "shop3"}, new Shop() {ShopId = 4, ShopName = "shop4"}, new Shop() {ShopId = 5, ShopName = "shop5"}, new Shop() {ShopId = 6, ShopName = "shop6"}, }; var inCause = new int[] { 1, 3, 5 };
IN句
var results = shops.Where(x => inCause.Contains(x.ShopId));
NOT IN句
var results = shops.Where(x => !inCause.Contains(x.ShopId));
以上。