Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save paggiogriot/87036a128c60a8bb4c94fc66e80c1e9e to your computer and use it in GitHub Desktop.
Save paggiogriot/87036a128c60a8bb4c94fc66e80c1e9e to your computer and use it in GitHub Desktop.
How do you perform a left outer join using linq extension methods
var qry = Foo.GroupJoin(
Bar,
foo => foo.Foo_Id,
bar => bar.Foo_Id,
(x,y) => new { Foo = x, Bars = y })
.SelectMany(
x => x.Bars.DefaultIfEmpty(),
(x,y) => new { Foo=x.Foo, Bar=y});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment