Mid From PDF LINQ LINQ

How to perform a left outer join in LINQ?

How to perform a left outer join in LINQ?

var leftJoin = from d in departments

join e in employees on d.Name equals e.Department

into empGroup

from emp in empGroup.DefaultIfEmpty()

select new { Department = d.Name, EmployeeName =

emp?.Name ?? "No Employee" };

Explanation:

Returns all departments with matching employees or “No Employee” if none exist.

More from LINQ Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details