AI智能
改变未来

遍历文件夹C#

List ls = new List();
string path = @“E:”;

DirectoryInfo dir = new DirectoryInfo(path);if (dir.Exists){DirectoryInfo dirD = dir as DirectoryInfo;FileSystemInfo[] files = dirD.GetFileSystemInfos();foreach (var item in files){ls.Add(item.Name);}}else{ls.Add(\"无\");}
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » 遍历文件夹C#