Skip to content

Commit 8187638

Browse files
authored
Remove AsQueryable() from left join code sample (#43807)
1 parent 832b05a commit 8187638

File tree

1 file changed

+14
-8
lines changed
  • docs/csharp/linq/standard-query-operators/snippets/standard-query-operators

1 file changed

+14
-8
lines changed

docs/csharp/linq/standard-query-operators/snippets/standard-query-operators/LeftOuterJoins.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,20 @@ from subgroup in gj.DefaultIfEmpty()
3636
private static void LeftOuterJoinMethodSyntax()
3737
{
3838
// <LeftOuterJoinMethod>
39-
var query = students.GroupJoin(departments, student => student.DepartmentID, department => department.ID,
40-
(student, departmentList) => new { student, subgroup = departmentList.AsQueryable() })
41-
.SelectMany(joinedSet => joinedSet.subgroup.DefaultIfEmpty(), (student, department) => new
42-
{
43-
student.student.FirstName,
44-
student.student.LastName,
45-
Department = department.Name
46-
});
39+
var query = students
40+
.GroupJoin(
41+
departments,
42+
student => student.DepartmentID,
43+
department => department.ID,
44+
(student, departmentList) => new { student, subgroup = departmentList })
45+
.SelectMany(
46+
joinedSet => joinedSet.subgroup.DefaultIfEmpty(),
47+
(student, department) => new
48+
{
49+
student.student.FirstName,
50+
student.student.LastName,
51+
Department = department.Name
52+
});
4753

4854
foreach (var v in query)
4955
{

0 commit comments

Comments
 (0)