You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected that FullGroupJoin will return all items, even those with null keys, but somehow FullGroupJoin does not return null keys.
I tried implementing custom comparer, but it did not help.
So to fix this, I am currently using "clever hack" for key functions using tuple: p => (p.Id, true).
This treats null keys as non-null. A record would work too I guess.
Is there any more clear way to make FullGroupJoin not ignore null keys?
Technically, this matches the behavior of Enumerable.Join. There is no mention of ignoring null in the documentation, but if you test it, you'll notice that nulls are excluded from analysis.
A ValueTuple<> (like you did) is the best way to get around it if you have null values that should be matched.
There's room for debate over whether nulls should be: a) silently ignored (as current, and like Join), b) explicitly ignored (via notnull and in docs), or c) handled properly. I can make decent arguments for any of the above, though I lean towards b) for semantic interpretation of null.
I expected that FullGroupJoin will return all items, even those with null keys, but somehow FullGroupJoin does not return null keys.
I tried implementing custom comparer, but it did not help.
So to fix this, I am currently using "clever hack" for key functions using tuple: p => (p.Id, true).
This treats null keys as non-null. A record would work too I guess.
Is there any more clear way to make FullGroupJoin not ignore null keys?
Null keys do not work: https://dotnetfiddle.net/iefSBj
Null keys work: https://dotnetfiddle.net/QS7ZNK
The text was updated successfully, but these errors were encountered: