欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

DirectInfo.GetFiles 排序 博客分类: 编程技术C#  

程序员文章站 2024-02-12 15:17:04
...

The order in which this function returns the file names is dependent on the file system type. With NTFS and CDFS file systems, the names are returned in alphabetical order. With FAT file systems, the names are returned in the order the files were written to the disk, which may or may not be in alphabetical order. 

 

DirectoryInfo di = new DirectoryInfo(@"d:/test/");

var files = di.GetFiles().OrderBy(f => f.Name);

 

var files = di.GetFiles().OrderBy(f => f.LastWriteTime);