Write a simple recursive function

xiaoxiao2021-03-06  63

private void button1_Click (object sender, System.EventArgs e) {digui (this.textBox1.Text);} private void digui (string path) {DirectoryInfo di = new DirectoryInfo (path); FileInfo [] SubFiles = di.GetFiles () ;

FileSysteminfo [] DIRS = di.getdirector (); this.richtextbox1.text = di.name "/ r / n"; // Add files in the current directory Foreach (fileInfo filenext in subfiles) {this.richtextbox1.text = " **** " filenext.name " / r / n ";} // subdirectory Regeneration Foreach (DirectoryInfo DINEXT IN DIRS) {this.richtextbox1.text =" **** "; DiGUI (DINEXT.FULLNAME);

}} ========= effect: a **** c.txt **** b **** E.txt should be: a **** c.txt **** b * ******* E.txt

转载请注明原文地址:https://www.9cbs.com/read-111653.html

New Post(0)