Linq right join
left join就把左边的表放在前面,right join就把右边的表放在前面
1 var temp = from c in dtcopy.AsEnumerable() 2 where !Equals(c.Field<int?>("ParentId"), null) 3 select c; 4 var rightjoin = from r in temp 5 join s in (from c in dt.AsEnumerable() 6 select new { DataTagId = c.Field<int>("DataTagId") }) 7 on r.Field<int?>("ParentId") equals s.DataTagId 8 into j 9 from jr in j.DefaultIfEmpty() 10 select new 11 { 12 NullDataTagId = jr != null ? jr.DataTagId : 0, 13 row = r 14 };