标签:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace File_Test { class GetImages { /// <summary> /// 获取指定的文件夹中的图片文件 /// </summary> /// <param name="userId"></param> /// <returns></returns> public string[] GetAllImages(string path) { List<string> imagesPath = new List<string>(); ; string[] strs = System.IO.Directory.GetFiles(path); foreach (string file in strs) { System.IO.FileInfo fi = new System.IO.FileInfo(file); if (fi.Extension == ".jpg" || fi.Extension == ".gif" || fi.Extension == ".bmp") { imagesPath.Add(fi.Name); } } return imagesPath.ToArray(); } } }
标签:
原文地址:http://www.cnblogs.com/mfc-itblog/p/4794132.html