C# winform获取选择文件夹中所有文件(不含文件夹)

        /// 
        /// 获取选择文件夹中所有文件(不含文件夹)
        /// 
        /// 
        /// 
        public static FileInfo[] GetAllFiles(string prompt)
        {
            FileInfo[] result = null;
            FolderBrowserDialog folderDialog = new FolderBrowserDialog();
            folderDialog.Description = prompt;
            if (folderDialog.ShowDialog() == DialogResult.OK)
            {
                string foldPath = folderDialog.SelectedPath;
                DirectoryInfo theFolder = new DirectoryInfo(foldPath);
                result = theFolder.GetFiles();
            }
            return result;
        }

 

你可能感兴趣的:(C#-winform)