I think this is called a decorator pattern? Come on, if I'm right. I never remember the name of the template.
I would create a class that was built in add and when built, has a Parent property property and just has node as a member. If there is an interface for BindingNode, then I would implement an interface with all the methods and properties passing through the real BindingNode.
public class BoundNode : INode { private INode _thisNode { get; private set; } public INode Parent { get; private set; } public BoundNode(INode bindingNode, INode parent) { _thisNode = bindingNode; Parent = parent; }
Then the add method implements
public Add(INode someNode) { _nodeList.Add(new BoundNode(someNode, this.Parent)); }
Or something like that ... however your collection knows about this node context ..
source share