Let's say I sorted the list of files in Explorer by name, for example:
2009-06-02-4.0.9.txt
2009-06-02-4.0.10.txt
2009-06-02-4.0.11.txt
2009-06-02-4.0.12.txt
I have a FileInfo Comparer that sorts an array of FileInfo objects by name:
class FileInfoComparer : IComparer<FileInfo> { public int Compare(FileInfo x, FileInfo y) { return string.Compare(x.FullName, y.FullName, StringComparison.OrdinalIgnoreCase); } }
Sorting the same list of files from above using this Comparer gives:
2009-06-02-4.0.10.txt
2009-06-02-4.0.11.txt
2009-06-02-4.0.12.txt
2009-06-02-4.0.9.txt
which is problematic, since order is extremely important.
I would suggest that there is a way to simulate what Windows does in C # code, but I still have to find a way. Any help is appreciated!
Thanks!
source share