相关疑难解决方法(0)

正确的Linq条款

我在日常生活中写了相当数量的linq,但大多是简单的陈述.我注意到在使用where子句时,有很多方法可以编写它们,并且每个方法都有相同的结果.例如;

from x in Collection
  where x.Age == 10
  where x.Name == "Fido"
  where x.Fat == true
  select x;
Run Code Online (Sandbox Code Playgroud)

至少就结果而言,似乎与此相当:

from x in Collection
  where x.Age == 10 &&
        x.Name == "Fido" &&
        x.Fat == true
  select x;
Run Code Online (Sandbox Code Playgroud)

那么语法之外真的有区别吗?如果是这样,首选的风格是什么?为什么?

c# linq

128
推荐指数
4
解决办法
29万
查看次数

标签 统计

c# ×1

linq ×1