【发布时间】:2017-02-02 05:48:52
【问题描述】:
我正在 LINQ Pad 和 Right, Left and Inner Joins 练习 LINQ,我注意到了一些事情
(from a in Employees join b in Persons
on a.PersonId equals b.PersonId into x
from c in x.DefaultIfEmpty()
select new {
a.EmployeeId,
c.PersonId,
c.CompleteName
}).Take(50).OrderByDescending(m => m.EmployeeId)
和
(from a in Persons join b in Employees
on a.PersonId equals b.PersonId
select new {
b.EmployeeId,
b.PersonId,
a.CompleteName
}).Take(50).OrderByDescending(m => m.EmployeeId)
结果相同。
(from a in Persons join b in Employees
on a.PersonId equals b.PersonId into x
from c in x.DefaultIfEmpty()
select
new {
c.EmployeeId,
c.PersonId,
a.CompleteName
}).Take(50).OrderByDescending(m => m.EmployeeId)
我在 linq 中搜索 right and left joins,但我的问题是我的示例中的右连接或左连接在哪里?
【问题讨论】: