1. 程式人生 > >C# Directory.GetFiles()獲取多個型別格式的檔案

C# Directory.GetFiles()獲取多個型別格式的檔案

第一種方式

System.IO.Directory.GetFiles()獲取多個型別格式的檔案
System.IO.Directory.GetFiles("c:\","(*.exe|*.txt)"); 

 第二種方式

var files = Directory.GetFiles("C:\\path", "*.*", SearchOption.AllDirectories)
.Where(s => s.EndsWith(".mp3") || s.EndsWith(".jpg"));

但這種寫法應該只有VS2008才支援,VS2005不支援


-------------------------------------------------------------------
請各位網友瞭解邪淫的危害,遠離邪淫


1.玉曆寶鈔視訊(土豆)
http://www.tudou.com/programs/view/nhxOfFOB5Fo/
2.風月場之陷阱
http://www.xuefo.net/nr/article13/130376.html
3.漫談兩性關係
http://wenku.baidu.com/link?url=r6eYr9qbSx6divz1C2xi14A-ZPkN05FBhzFc9KVypzAoCoMk-vuuyM9eFyL_0H7G_MSgKR9SKIyniFwQ-N5bxwonjdXOwn4nURvV5MypY8S
4.戒除邪淫(學佛網)文章
http://www.xuefo.net/ztzl_10.htm
5.邪淫的因果(視訊)
http://www.fodizi.com/fofa/list/7906.htm
6.壽康寶鑑(百度文章)
http://baike.baidu.com/link?url=E_DulKa0ERhxxZP6sNMT_2pVjLrta1qIEjPftxPlfjuehFK-NKitLCQPXTYil7ttDqLqLFUltfleNde_P-gSya
-------------------------------------------------------------------