我有一个LINQ语句,我正在加入ID字段。问题是有时“等于”左侧的ID可能为空 有没有办法解决这个问题?
答案 0 :(得分:6)
from x in left
where x.Id != null
join y in right on x.Id equals y.Id into rightMatches
from y2 in rightMatches.DefaultIfEmpty() //in your comments you said LEFT JOIN
select new {x, y2};