LINQ:Group Join
作者:互联网
1.代码
//group join var groupJoinQS = from addr in Address.GetAddress() join emp in Employee.GetAllEmployees() on addr.ID equals emp.AddressId into ADDEmp select new { addr, ADDEmp }; foreach (var item in groupJoinQS) { Console.WriteLine(item.addr); Console.WriteLine(item.ADDEmp); Console.WriteLine(item.addr.AddressLine); foreach (var employee in item.ADDEmp) { Console.WriteLine(" EmployeeID : " + employee.ID + " , Name : " + employee.Name); } }
2.测试结果如下
所以ADDEmp指的是Employee?
参考:
https://dotnettutorials.net/lesson/linq-group-join/
标签:Console,Group,addr,LINQ,item,WriteLine,var,Join,ADDEmp 来源: https://www.cnblogs.com/keeplearningandsharing/p/16620922.html