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

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -