Added AncestorOrSelf overload which doesn't require a Func<DynamicNode,bool> argument Both changes modify DynamicNode.Parent so that if there is no parent, it returns itself instead of null, (you can't new DynamicNode(null) as it throws exception) and then in the AncestorOrSelf checks, the loop makes sure that it won't get stuck by continually returning itself (because this.Parent returns this)