Sort Files exactly like Windows Explorer By Name RRS feed

  • Question

  • I'm trying to get a sorted list of files exactly the same as windows explorer. The code I'm using is:

    List<FileInfo> fileList = di.GetFiles(pattern).ToList();
    fileList.Sort((a, b) => string.Compare(a.Name, b.Name));

    The files I'm using look like this:

    0001000A.tif, 0001000B.tif, 0001000C.tif, 00010001.tif ... 00010009.tif, 00010010.tif...

    That is how they are listed in windows explorer but when I get a my list in code I get:

    00010000.tif, 00010002.tif, ... 00010009.tif, 0001000A.tif, 0001000B.tif ... 00010010.tif

    does anybody have any idea how I can do this?



    Thursday, July 23, 2015 5:03 PM


All replies