编程语言
首页 > 编程语言> > C#文件目录遍历

C#文件目录遍历

作者:互联网

DirectoryInfo TheFolder=new DirectoryInfo(folderFullName);
//遍历文件夹
foreach(DirectoryInfo NextFolder in TheFolder.GetDirectories())
   this.listBox1.Items.Add(NextFolder.Name);
//遍历文件
foreach(FileInfo NextFile in TheFolder.GetFiles())
   this.listBox2.Items.Add(NextFile.Name);

 

标签:遍历,文件目录,Name,C#,Items,DirectoryInfo,NextFolder,TheFolder
来源: https://www.cnblogs.com/fengxiaokang/p/13745204.html