可能重复:
Natural Sort Order in C#
如何以与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
答案 0 :(得分:0)
特殊排序是new feature added in WinXP。您最好的选择是在使用Directory.GetFiles()
加载集合后,重新实现相同的排序算法(请参阅上面的链接以了解如何操作)。