标签:
左连接:
var LeftJoin = from emp in ListOfEmployees
join dept in ListOfDepartment on emp.DeptID equals dept.ID into JoinedEmpDept
from dept in JoinedEmpDept.DefaultIfEmpty()
select new
{
EmployeeName = emp.Name,
DepartmentName = dept != null ? dept.Name : null
};
右连接:
var RightJoin = from dept in ListOfDepartment
join employee in ListOfEmployees on dept.ID equals employee.DeptID into joinDeptEmp
from employee in joinDeptEmp.DefaultIfEmpty()
select new
{
EmployeeName = employee != null ? employee.Name : null,
DepartmentName = dept.Name
};
标签:
原文地址:http://www.cnblogs.com/cllchaoblog/p/4328683.html