Joining two IEnumerable
Little cleaner:

// Common Keys between left and right
var result = lChildren.Where(s =&gt; rChildren.Select(p =&gt; getKey(p)).Contains(getKey(s))).ToList();

// new keys added to right
result.AddRange(rChildren.Where(s =&gt; lChildren.Select(p =&gt; getKey(p)).Contains(getKey(s)) == false));

return result;


Without ToList():

public static IEnumerable&lt;T&gt; Merge&lt;T&gt;(this IEnumerable&lt;T&gt; first, IEnumerable&lt;T&gt; second)
{
    foreach (var item in first)
        yield return item;

    foreach (var item in second)
        yield return item;
}


In your NodeMerge method:

return lChildren.Where(s =&gt; rChildren.Select(p =&gt; getKey(p)).Contains(getKey(s))).Merge(rChildren.Where(s =&gt; lChildren.Select(p =&gt; getKey(p)).Contains(getKey(s)) == false));