DirectInfo.GetFiles返回数组的默认排序

来源:互联网 发布:淘宝app视频下载 编辑:程序博客网 时间:2024/06/03 15:57

这个问题来自论坛提问,其实这个函数在.net类库中还有其他等效的函数,这一系列函数的返回结果都是文件名组成的数组,那么他们的默认顺序是根据什么来排列的?开始随口回答人家说是文件名,当然被人小小的bs了一下...稍微考虑一下,这系列函数无非是通过FindFirstFile和FindNextFile这些widows api函数来实现的,拿这些函数的默认顺序是什么呢,msdn了一下,得到如下结果

 

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.

 

大致意思是
NTFS和CDFS下,是按照字母顺序,而FAT下,按照文件创建时间顺序

原创粉丝点击