ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` FolderBrowserDialog fbdlg = new FolderBrowserDialog(); fbdlg.Description = "请选择文件路径"; if (fbdlg.ShowDialog() == DialogResult.OK) { string foldPath = fbdlg.SelectedPath; textBox1.Text = foldPath; return; DirectoryInfo theFolder = new DirectoryInfo(foldPath); FileInfo[] dirInfo = theFolder.GetFiles(); //遍历文件夹 foreach (FileInfo file in dirInfo) { MessageBox.Show(file.ToString()); } } ```