dtc*_*dtc 15 .net sql linq .net-3.5 linq-to-sql
Select和SelectMany是否更喜欢加入?
我想知道的原因是因为我使用LinqPad并且在一个部分中有评论说:
// Note: before delving into this section, make sure you've read the preceding two
// sections: Select and SelectMany. The Join operators are actually unnecessary
// in LINQ to SQL, and the equivalent of SQL inner and outer joins is most easily
// achieved in LINQ to SQL using Select/SelectMany and subqueries!
Run Code Online (Sandbox Code Playgroud)
然而,在其他部分中,它清楚地表明连接速度更快(至少对于LinqPad中给出的示例),对我来说,它们更容易在我的脑海中可视化.
也许我误解了,因为我只是查看代码示例而不是书,但我看到其他人也推荐Select和SelectMany而不是Joins.