Selectmany linq lambda where clause

c # - link - linq select new lambda

This is the general form (as already stated in other answers)

But here's an explanation that hopefully will clear up what that actually means!

Essentially creates a separate result set b_temp, which effectively contains null rows for entries on the right (entries in "b").

Then the next line:

.. over this result set, sets the standard zero value for the 'line' on the right side and sets the result of the right line connection to the value of 'b_value' (ie the value on the right side) hand side, if a suitable data record is available is, or "zero" if not present.

If the right side is the result of a separate LINQ query, it is now made up of anonymous types, which can be either just 'something' or 'null'. However, if it is a bullet (e.g. a list - where MyObjectB is a two field class) it is possible to specify exactly which default values ​​are used for the 'Null' properties:

This ensures that "b" is not itself null (however, its properties can be null by using the default null values ​​you specify). This allows you to check the properties of b_value without getting a null reference exception for b_value. Note that for a Nullable DateTime a type of (DateTime?) Ie 'Nullable DateTime' must be specified as 'Type' of zero in the specification for 'DefaultIfEmpty' (this also applies to types that are not 'native') 'Nullable e.g. Double, Float).

You can do multiple left outer joins simply by concatenating the above syntax.