Javatpoint Logo
Javatpoint Logo

LINQ Left Outer Join

In LINQ, LEFT JOIN or LEFT OUTER JOIN is used to return all the records or elements from the left side collection and matching the elements from the right side of the collection.

In LINQ, to achieve the LEFT Join behavior, it is mandatory to use the "INTO" keyword and "DefaultfEmpty()" method.

Syntax of LINQ Left Outer Join

The syntax of using the LINQ Left Outer Join to get all the elements from the collection and matching the element from the right collection.

From the above syntax, we used into and DefaultfEmpty() methods to implement the left outer join to get the elements from the "objEmp1", "objDept1" collections.

Example of LINQ Left Outer Join

Here is the example of using the LINQ Left Outer Join to get the elements from the collections based on the specified conditions.

From the above example, we are getting the elements from "objEmp1", "objDept1" collections by using left outer join in LINQ and here we specified the condition to check if there is a department for the employee or not. In case if the department not mapped, it will take "No Department" from the condition.

OUTPUT:

LINQ Left Outer Join
Next TopicLINQ Cross Join




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA