View difference between Paste ID: VbYxZe1z and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | sealed class Dumper |
2 | { | |
3 | static public string Dump(Node root) | |
4 | { | |
5 | return Dump( root, "" ); | |
6 | } | |
7 | static private string Dump(Node node, string indent) | |
8 | { | |
9 | return node.Text + "\n" + | |
10 | ( node.Children.Count == 0 | |
11 | ? "" : node.Children.Take(node.Children.Count - 1). | |
12 | Aggregate(string.Empty, (results, child) => | |
13 | results + indent + "├─" + Dump(child, indent + "│ ") ) | |
14 | + indent + "└─" + Dump(node.Children.Last(), indent + " " ) ); | |
15 | } | |
16 | } |