Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jmrnilsson/73b02af88162af09d5718d83a75234c6 to your computer and use it in GitHub Desktop.
Save jmrnilsson/73b02af88162af09d5718d83a75234c6 to your computer and use it in GitHub Desktop.
Example: Outer join and group join examples in C# FLWR and "method chaining "
var q =
from iu in Items
join u in OtherItems on iu.Id equals u.Id into ug
from u in ug.DefaultIfEmpty()
where u == null
orderby iu.Id
select iu;
var q1 =
Items
.GroupJoin(OtherItems, iu => iu.Id, u => u.Id, (iu, u) => new {iu, u})
.Where(a => !a.u.Any())
.OrderBy(a => a.iu.Id)
.Select(a => a.iu);
q.Take(3).Dump("_0");
q1.Take(3).Dump("_1");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment