I’m making a class that will hold a list of child instances which I need to make remember their parent object.
class Node
{
List<Node> childNodes;
Node ParentNode;
public Node(List<Node> nodes)
{
childNodes = nodes;
foreach (var node in childNodes)
{
node.ParentNode = this;
}
}
}
Is this a good way or am I missing something?
1 Answer