示例#1
0
        static void Main(string[] args)
        {
            List <string[]> orbitList = new List <string[]>();

            using (Stream stream = File.OpenRead(@"..\..\..\Day06_Input.txt"))
                using (StreamReader reader = new StreamReader(stream))
                {
                    bool   first = true;
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        string[] s = line.Split(')');

                        if (first)
                        {
                            TreeNode <string> node = new TreeNode <string>(s[0]);
                            tree = new TreeNodeList <string>(node);
                            node.Children.Add(new TreeNode <string>(s[1]));
                            first = false;
                        }

                        else
                        {
                        }
                    }
                }
        }
示例#2
0
 public TreeNode(T Value, TreeNode <T> Parent)
 {
     this.Value  = Value;
     this.Parent = Parent;
     Children    = new TreeNodeList <T>(this);
 }
示例#3
0
 public TreeNode(T Value)
 {
     this.Value = Value;
     Parent     = null;
     Children   = new TreeNodeList <T>(this);
 }