When to prefer joins expressed with SelectMany() over joins expressed with the join keyword in Linq

后端 未结 2 772
误落风尘
误落风尘 2021-01-12 06:08

Linq allows to express inner joins by using the join keyword or by using SelectMany() (i.e. a couple of from keywords) with a where keyword:

var personsToSta         


        
2条回答
  •  北海茫月
    2021-01-12 06:39

    Join is more efficient, it uses Lookup class (a variation of Dictionary with multiple values for a single key) to find matching values.

提交回复
热议问题