LINQ Inner-Join vs Left-Join

前端 未结 6 1128
轮回少年
轮回少年 2020-11-27 13:36

Using extension syntax I\'m trying to create a left-join using LINQ on two lists that I have. The following is from the Microsoft help but I\'ve modified it to show that the

6条回答
  •  悲&欢浪女
    2020-11-27 14:24

    Left joins in LINQ are possible with the DefaultIfEmpty() method. I don't have the exact syntax for your case though...

    Actually I think if you just change pets to pets.DefaultIfEmpty() in the query it might work...

    EDIT: I really shouldn't answer things when its late...

提交回复
热议问题