2
可能重複:
Natural Sort Order in C#如何以與在Windows資源管理器中相同的順序從目錄中獲取文件?
我怎麼能以相同的順序讀取一個目錄下的文件顯示在Windows資源管理器?
例如,Windows資源管理器列表:
file 1.txt
file 2.txt
file 3.txt
file 4.txt
file 5.txt
file 6.txt
file 7.txt
file 8.txt
file 9.txt
file 10.txt
file 11.txt
file 12.txt
而Directory.GetFiles()名單:
file 1.txt
file 10.txt
file 11.txt
file 12.txt
file 2.txt
file 3.txt
file 4.txt
file 5.txt
file 6.txt
file 7.txt
file 8.txt
file 9.txt
[編輯]
在這裏你可以找到另一種解決方案這個:http://www.codeproject.com/KB/recipes/csnsort.aspx?msg=3342284