Code Bye

c#用GetFiles()获得的文件列表,怎么样排序才能与在本机文件夹上按名称排的完全一致

借用下别人的图

foreach里遍历顺序列出来

只能本人写算法吗?
解决方案

2

http://bbs.csdn.net/topics/350096947
fileList= fileList.OrderBy(s =>int.Parse( Regex.Match(s, @”\d+”).Value)).ToArray();

3

http://blog.sina.com.cn/s/blog_752ca76a010173tr.html

35

Array.Sort(fileEntries, (x1, x2) => int.Parse(Regex.Match(x1.Name, @”\d+”).Value).CompareTo(int.Parse(Regex.Match(x2.Name, @”\d+”).Value)));

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明c#用GetFiles()获得的文件列表,怎么样排序才能与在本机文件夹上按名称排的完全一致