C# Linq Inner Join

后端 未结 3 1107
梦如初夏
梦如初夏 2021-01-11 18:20

I want to select the persons only who are having pets.

when I execute the query

var query = from p in people
                        join
                   


        
3条回答
  •  囚心锁ツ
    2021-01-11 18:45

    this can also be done using lambda expressions in a single line of code...

    IEnumerable peopleWithPets = people.Where(x => pets.Any(y => y.Owner == x));
    

提交回复
热议问题