Mid From PDF LINQ LINQ

How to group join with multiple collections?

How to group join with multiple collections?

var groupJoin = from d in departments

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

into empGroup

select new { Department = d.Name, Employees =

empGroup };

foreach (var group in groupJoin)

Console.WriteLine($"{group.Department}:");

foreach (var emp in group.Employees)

Console.WriteLine($" - {emp.Name}");

Follow :

Explanation:

Groups employees under their respective departments.

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