检索文件夹中的文件名

//引入命名空间
using System.IO;


DirectoryInfo di = new DirectoryInfo(Server.MapPath("file"));
            FileSystemInfo[] dis = di.GetFileSystemInfos();
            if (dis == null || dis.Length <= 0) return null;
            ///将文件名称保存到临时数组中
            string[] tempFileList = new string[dis.Length];
            for (int i = 0; i < dis.Length; i++)
            {
                tempFileList[i] = dis[i].Name;
            }
            ///对数组进行排序
            Array.Sort(tempFileList, new CaseInsensitiveComparer());
            autoCompleteFileList = tempFileList;

你可能感兴趣的:(java)