views:

48

answers:

2

Possible Duplicate:
LINQ Inner-Join vs Left-Join

How can i implement left join in LINQ?

plz provide me sample code.

A: 

have a look on Left Outer Joins

anishmarokey
A: 
from e in db.Employees
join d in db.Departments on e.DepartmentId equals d.DepartmentId into MyJoinedTable
from joinedRow in MyJoinedTable.DefaultIfEmpty()
select new
{
    Employee = e,
    Department = d,
};
John Gietzen