Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sealed class Dumper
- {
- static public string Dump(Node root)
- {
- return Dump( root, "" );
- }
- static private string Dump(Node node, string indent)
- {
- return node.Text + "\n" +
- ( node.Children.Count == 0
- ? "" : node.Children.Take(node.Children.Count - 1).
- Aggregate(string.Empty, (results, child) =>
- results + indent + "├─" + Dump(child, indent + "│ ") )
- + indent + "└─" + Dump(node.Children.Last(), indent + " " ) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement