久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

LINQ Where in collection 子句

LINQ Where in collection clause(LINQ Where in collection 子句)
本文介紹了LINQ Where in collection 子句的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我一直在 google 上搜索,但沒有找到任何對我有用的東西.

I've been looking on google but not finding anything that does the trick for me.

如您所知,SQL 有一個where x in (1,2,3)"子句,它允許您檢查多個值.我正在使用 linq,但似乎找不到與上述語句相同的語法.

as you know SQL has a "where x in (1,2,3)" clause which allows you to check against multiple values. I'm using linq but I can't seem to find a piece of syntax that does the same as the above statement.

我有一個類別 ID(列表)的集合,我想根據這些集合進行檢查

I have a collection of category id's (List) against which I would like to check

我發現了一些使用 .contains 方法的東西,但它甚至沒有構建.

I found something that uses the .contains method but it doesn't even build.

推薦答案

你必須在你的 id 列表中使用 Contains 方法:

You have to use the Contains method on your id list:

var query = from t in db.Table
            where idList.Contains(t.Id)
            select t;

這篇關于LINQ Where in collection 子句的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Why shouldn#39;t I always use nullable types in C#(為什么我不應該總是在 C# 中使用可空類型)
C# HasValue vs !=null(C# HasValue vs !=null)
C# ADO.NET: nulls and DbNull -- is there more efficient syntax?(C# ADO.NET:空值和 DbNull —— 有沒有更高效的語法?)
How to set null value to int in c#?(如何在c#中將空值設置為int?)
How to handle nulls in LINQ when using Min or Max?(使用 Min 或 Max 時如何處理 LINQ 中的空值?)
Method call if not null in C#(在 C# 中如果不為 null 的方法調用)
主站蜘蛛池模板: 久久av网站 | 自拍视频网站 | 国产亚洲欧美在线 | 蜜桃av鲁一鲁一鲁一鲁 | 日韩精品久久久 | 国产激情在线观看 | 夜夜爽99久久国产综合精品女不卡 | 天天操天天怕 | 欧美精品久久 | 久久成人免费 | 国产精品免费在线 | 欧美久久久久 | 欧美激情综合五月色丁香小说 | 日韩精品免费在线观看 | 精品国产一区二区三区久久久四川 | 久久狠狠| 日韩成人免费视频 | 一区二区三区日韩精品 | 国产精品18hdxxxⅹ在线 | 在线看av的网址 | 久久久久中文字幕 | 国产一区二区影院 | 亚洲自拍偷拍免费视频 | 久久6| 日韩福利电影 | 国产精品一区二区在线播放 | 青青伊人久久 | 7799精品视频天天看 | 欧美毛片免费观看 | 神马福利 | 久久国产精品-国产精品 | 日本大片在线播放 | 最新免费视频 | 天堂成人国产精品一区 | 久久中文字幕一区 | 中文字幕亚洲欧美 | 亚洲国产精品99久久久久久久久 | 久久精品国产99国产精品亚洲 | 亚洲精品一区二三区不卡 | 国产福利91精品 | 97人澡人人添人人爽欧美 |