LINQ Left Outer Join

Linq Left Outer Join

var result = from a in dc.TABLEA.ToList()
join b in dc.TABLEB
on a.Title equals b.Title
into joined
from b in joined.DefaultIfEmpty()
select new
{
a.ImageUrl,
a.AlternateText,
a.ToolTip,
headline = (b == null ? string.Empty : b.Headline),
content = (b == null ? string.Empty : b.Description)
};

Advertisement