Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static class Dumper
- {
- static public string Dump(Node root)
- {
- return Dump(root, "");
- }
- static private string Dump(Node root, string indent)
- {
- string result = root.Text;
- for (int i = 0; i < root.Children.Count; i++)
- {
- bool isLastNode = (i == root.Children.Count - 1);
- result += "\n";
- result += indent;
- result += isLastNode ? "└─" : "├─";
- result += Dump(root.Children[i], indent + (isLastNode ? " " : "│ "));
- }
- return result;
- }
- }
Add Comment
Please, Sign In to add comment