Could someone give me an example of how to perform a left join operation using LINQ/lambda expressions?
well i tried to reproduce the famous left join where b key is null and the result i got is this extension method (with a little imagination you can modify it to just make a left join):
public static class extends
{
public static IEnumerable LefJoinBNull(this IEnumerable source, IEnumerable Target, Func key)
{
if (source == null)
throw new ArgumentException("source is null");
return from s in source
join j in Target on key.Invoke(s) equals key.Invoke(j) into gg
from i in gg.DefaultIfEmpty()
where i == null
select s;
}
}