public FuncTreeNode AddNodes(string xpath) { string[] paths = xpath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); if (paths.Length == 0) { throw new Exception("Unable to add the root node"); } int index = 0; FuncTreeNode tmp = this; while (index < paths.Length) { string tmpNodeName = paths[index]; if (!tmp.Nodes.ContainsKey(tmpNodeName)) { tmp = tmp.AddNode(tmpNodeName); } else { tmp = tmp.Nodes[tmpNodeName]; } index++; } return(tmp); }