c# - How does LINQ's left-join `join ... into` and `DefaultIfEmpty()` work? -


how linq's join ... into , .defaultifempty() work express left-join?

does .defaultifempty() evaluated once, or n times?

assuming we're talking linq objects, defaultifempty evaluated once per element in result. evaluated on sequence group of values matching "left" part of join. if have:

from x in foo join y in bar z let g = z.defaultifempty() select new { x, g.count() } 

then each x value, there invocation of defaultifempty. non-empty sequences, pass values through. empty sequences, default value returned (once) instead.

see my edulinq blog post on it more information.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -