I have 2 lists of the same type. The left list:
var leftList = new List();
leftList.Add(new Person {Id = 1, Name = \"John\", Chang
Well spender was faster then me, I did without any extension method.
Without any extension method:
List mergedList = leftList
.GroupJoin(
rightList, left => left.Id, right => right.Id,
(x, y) => new { Left = x, Rights = y }
)
.SelectMany(
x => x.Rights.DefaultIfEmpty(),
(x, y) => new Person
{
Id = x.Left.Id,
Name = x.Left.Name,
Changed = y == null ? x.Left.Changed : y.Changed
}
).ToList();
The GroupJoin makes left outer join operation.