How to traverse a multi-hierarchy array in C#
<p>Say rootNode is a multi-hierarchy data structure.</p>

<pre><code>rootNode.Add(node1);
rootNode.Add(node2);
node1.Add(node3);
node1.Add(node4);
node3.Add(node5);
</code></pre>

<p>If use foreach to traverse rootNode will only get node1, node2. How do I traverse all nodes in rootNode?</p>

<pre><code>foreach(var node in rootNode){...}
</code></pre>
