Linq query for Nested child litems n-depth c# : <p>Trying to query child item of same object to n-depth and display in the below format. So for each sub cat add tab space.</p>

<pre><code>Cat 1
   Sub Cat 1 - 1
   Sub Cat 1 - 2
Cat 2
   Sub Cat 2 - 1
   Sub Cat 2 - 2
          Sub Cat 3 - 2 - 2

class NavItem {
    public string label { get; set; }
    public List&lt;NavItem&gt; childItems { get; set; }
}
</code></pre>

<p>Create item, </p>

<pre><code>var item = new NavItem()
            {
                label = "Root",
                childItems = new List&lt;NavItem&gt;() {
                    new NavItem() { label = "Cat 1" , childItems = new  List&lt;NavItem&gt;() {
                        new  NavItem() { label = "Sub Cat 1 - 1" },
                        new  NavItem() { label = "Sub Cat 1 - 2" },
                    } },
                    new NavItem() { label = "Cat 2", childItems = new  List&lt;NavItem&gt;() {
                        new  NavItem() { label = "Sub Cat 2 - 1" },
                        new  NavItem() { label = "Sub Cat 2 - 2", childItems = new List&lt;NavItem&gt;() {
                            new NavItem() { label = "Sub Cat 3 - 2 - 2"}
                        } },
                    }  }, 
                }
            };
</code></pre>

<p>I have below code, which is not complete. it can go only two depth</p>

<pre><code>item.childItems.ForEach(i =&gt; {
                Console.WriteLine(i.label);
                i.childItems.ForEach(i1 =&gt;
                {
                    Console.WriteLine("\t" + i1.label);
                });
            });
</code></pre>
