I have a situation where an object A has a reference to object B. B also has a reference back to A. For the sake of simplicity, let's say that A and B are of the same type. How do I ensure that when I update the reference on A, that the update will be reflected on B as well (and vice versa)?
An example of an interface of such a type:
interface IGraphNode
{
IGraphNode From { get; set; }
IGraphNode To { get; set; }
}
After executing the code below, I would expect B.From
to return A.
IGraphNode A = new GraphNode();
IGraphNode B = new GraphNode();
A.To = B;