Linq 'into' keyword confusion

前端 未结 3 1295
走了就别回头了
走了就别回头了 2020-12-13 05:31

I was looking at a co-workers Linq query, shown below (the query executes correctly):

from ea in EquipmentApplication
join erl in EquipmentRoutingLocation on         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 05:53

    "into" has two different meanings:

    • In a join clause, it changes the translation from using Join to GroupJoin. This means that instead of getting one result per matching pair, you get one result for each element of the original sequence, and that result contains the key and all the results from the other sequence, as a group. See Enumerable.GroupJoin for more details
    • In a select or group...by it becomes a query continuation, effectively starting a new query with the results of the old one in a new range variable.

提交回复
热议问题