If you want to duplicate the natural sort order used in Windows Explorer, the simplest option is to P/Invoke the StrCmpLogicalW function[^] from shlwapi.dll:
public class LogicalStringComparer : IComparer
{
[DllImport("shlwapi.dll", CharSet=CharSet.Unicode, ExactSpelling=true, SetLastError=true)]
private static extern int StrCmpLogicalW(string x, string y);
public int Compare(string x, string y)
{
return StrCmpLogicalW(x, y);
}
}
StrCmpLogicalW on MSDN[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer