Linq join on two values

后端 未结 2 1903
無奈伤痛
無奈伤痛 2021-01-16 19:14

Suppose I have a list of {City, State}. It originally came from the database, and I have LocationID, but by now I loaded it into memory. Suppose I also have a t

2条回答
  •  孤独总比滥情好
    2021-01-16 19:44

    It seems to me that you need this:

    var establishments =
        from r in restaurants
        join l in locations.Where(x => x.LocationId == id)
            on new { r.City, r.State } equals new { l.City, l.State } into gls
        select r;
    

提交回复
热议问题