can't sort files from folder in String[] Array

后端 未结 4 941
既然无缘
既然无缘 2021-01-28 04:06

my project is about recording screen as sequence of images then instead of make it as video i planed to load all image directories to list and use timer to view them image by im

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-28 04:09

    The strings are sorted: in lexicographic order...

    you have two options: rename the files so they be ordered in lexicographic order (eg: 001, 002, 003...), or, using linq, and file name manipulations:

    IEnumerable sorted = from filename in array1
                                 orderby int.Parse(Path.GetFileNameWithoutExtension(filename))
                                 select filename;
    

提交回复
热议问题