title: get tree structure of a directory with its subfolders and files using C#.net in windows application
body: <p>I have a directory '0'(say) and subfolders and files as shown below </p>
  
  <pre><code>0-
   0.1
      0.1.1
           A.rdb  
           B.xml
       0.1.2
           A.rdb  
           B.xml
   0.2
      0.2.1
           A.rdb  
           B.xml
       0.1.2
           A.rdb  
           B.xml
  </code></pre>
  
  <p>here is the code that i am using for it is below,</p>
  
  <pre><code>List&lt;string&gt; folders = new List&lt;string&gt;();
          DirectoryInfo di = new DirectoryInfo(textBox1.Text);
          IEnumerable&lt;string&gt; IEstring;
          IEstring = from subdirectory in di.GetDirectories()
                     where subdirectory.GetFiles("*.*", SearchOption.AllDirectories).Length &gt; 0
                     select subdirectory.Name;
          folders = IEstring.ToList();
          List&lt;String&gt; files = DirSearch(textBox1.Text);
          textBox2.Text = textBox2.Text+ displayMembers(files);
  </code></pre>
  
  <p>The problem is i am unable to print this list named "files" I don't know where I am doing wrong here. </p>
  
  <p>I also needed the result of folders and files to be printed in new excel spreadsheet. The result show be the same as this </p>
  
  <pre><code>0-
       0.1
          0.1.1
               A.rdb  
               B.xml
           0.1.2
               A.rdb  
               B.xml
       0.2
          0.2.1
               A.rdb  
               B.xml
           0.1.2
               A.rdb  
               B.xml
  </code></pre>
  
  <p>But in spreadsheet.</p>