예제 #1
0
            public NodeGenerate GetOrCreateChildNode(int childNum)
            {
                NodeGenerate childNode;
                var          children = _children;

                if (children == null)
                {
                    childNode = new NodeGenerate(childNum, this);
                    _children = new Dictionary <int, NodeGenerate> {
                        { childNum, childNode }
                    };
                    return(childNode);
                }

                if (!children.TryGetValue(childNum, out childNode))
                {
                    children[childNum] = childNode = new NodeGenerate(childNum, this);
                }

                return(childNode);
            }
예제 #2
0
 private NodeGenerate(int id, NodeGenerate parentNode)
 {
     ID         = id;
     ParentNode = parentNode;
 }