Home > Net >  Linq left have bosses to explain the principle of connection principle?
Linq left have bosses to explain the principle of connection principle?

Time:10-10

Int [] intAry1={5, 15, 23, 30, 40, 33};
Int [] intAry2={10, 20, 30, 50, 60, 70, 80};
Var query1=
The from val1 intAry1 in
The join val2 intAry2 on val1%5 equals in val2%15 into val2Grp
The from GRP in val2Grp. DefaultIfEmpty (int. MaxValue)
Select new {VAL1=VAL1, VAL2GRP=GRP};


Why the above code can achieve left connections? Val2Grp only saved intAry2 grouping result, finally select how together?

CodePudding user response:

Because the join of two tables have
And DefaultIfEmpty get back on the left table is given priority to, do not exist,
2 and set is left join,
  •  Tags:  
  • C #
  • Related