C# 遍历文件夹

C#遍历浏览某个文件夹下的所有文件,方法如下:

 1 //C#遍历指定文件夹中的所有文件 
 2             DirectoryInfo TheFolder = new DirectoryInfo(path);
 3             if (!TheFolder.Exists)
 4                 return;
 5 
 6             //遍历文件
 7             foreach (FileInfo NextFile in TheFolder.GetFiles())
 8             {
 9                 if (NextFile.Name == "0-0-11.grid")
10                     continue;
11           // 获取文件完整路径 12 string heatmappath = NextFile.FullName;

}

猜你喜欢

转载自www.cnblogs.com/minnong/p/11009359.html