|
|
|
C# เอาโค้ดในการค้นหาไฟล์ แบบ multiple filters มาฝาก ครับ |
|
|
|
|
|
|
|
Code (C#)
public static class Files
{
public static List<string> GetFiles(string path, string pattern, System.IO.SearchOption searchOption = System.IO.SearchOption.TopDirectoryOnly)
{
List<string> lst = new List<string>();
List<string> _cri = pattern.Split(';').ToList<string>();
return GetFiles(path, _cri, searchOption);
}
public static List<string> GetFiles(string path, List<string> pattern, System.IO.SearchOption searchOption = System.IO.SearchOption.TopDirectoryOnly)
{
List<string> lst = new List<string>();
pattern.ForEach(cri => { lst.AddRange(System.IO.Directory.GetFiles(path, cri, searchOption)); });
return lst;
}
}
Tag : .NET, Win (Windows App), C#, VS 2012 (.NET 4.x), VS 2013 (.NET 4.x)
|
|
|
|
|
|
Date :
2018-10-10 23:06:50 |
By :
lamaka.tor |
View :
874 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Very good!!
|
|
|
|
|
Date :
2018-10-12 15:03:50 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|