小编Mad*_*Lad的帖子

在lambda表达式的子句中

var Charts = chartGroup
     .Descendants("charts")
     .Elements("chart")
     .Where(x => x.Attribute("id").Value == chartId.ToString())
     .Select(x => x.Attribute("name").Value).ToList();
Run Code Online (Sandbox Code Playgroud)

在这里,我想使用"in-clause"(如inSQL中的子句)来Attribute("id").Value表示字符串数组:

喜欢:

Where(x => x.Attribute("id").Value in ("1","2")
Where(x => x.Attribute("id").Value` in charIds[]
Run Code Online (Sandbox Code Playgroud)

怎么实现这个?

c# linq lambda

8
推荐指数
1
解决办法
3万
查看次数

标签 统计

c# ×1

lambda ×1

linq ×1