public static ReferenceNode CloneTree(ReferenceNode root) { ReferenceNode ret = new ReferenceNode(root.strResources); if (root.child != null) { foreach (ReferenceNode son in root.child) { ReferenceNode sonnode = CloneTree(son); if (sonnode != null) { ret.AddDependencyNode(sonnode); } } } return(ret); }