代码如下:public class FileAccess{ //储存所有文件夹名private ArrayList dirs; public FileAccess(){dirs = new ArrayList();} //获取所有文件名private ArrayList GetFileName(string dirPath){ArrayList list = new ArrayList(); if (Directory.Exists(dirPath)){list.AddRange(Directory.GetFiles(dirPath));}return list;} //获取所有文件夹及子文件