1.     static class Dumper
  2.     {
  3.         static public string Dump(Node root)
  4.         {
  5.             return Dump(root, "");
  6.         }
  7.  
  8.         static private string Dump(Node root, string indent)
  9.         {
  10.             string result = root.Text;
  11.             for (int i = 0; i < root.Children.Count; i++)
  12.             {
  13.                 bool isLastNode = (i == root.Children.Count - 1);
  14.  
  15.                 result += "\n";
  16.                 result += indent;
  17.                 result += isLastNode ? "└─" : "├─";
  18.                 result += Dump(root.Children[i], indent + (isLastNode ? "  " : "│ "));
  19.             }
  20.             return result;
  21.         }
  22.     }