LEFT OUTER JOIN in LINQ

后端 未结 22 2510
臣服心动
臣服心动 2020-11-21 04:49

How to perform left outer join in C# LINQ to objects without using join-on-equals-into clauses? Is there any way to do that with where clause? Corr

22条回答
  •  别跟我提以往
    2020-11-21 05:17

    This is a SQL syntax compare to LINQ syntax for inner and left outer joins. Left Outer Join:

    http://www.ozkary.com/2011/07/linq-to-entity-inner-and-left-joins.html

    "The following example does a group join between product and category. This is essentially the left join. The into expression returns data even if the category table is empty. To access the properties of the category table, we must now select from the enumerable result by adding the from cl in catList.DefaultIfEmpty() statement.

提交回复
热议问题