Skip to content

Instantly share code, notes, and snippets.

@forcewake
Created June 20, 2013 07:29
Show Gist options
  • Save forcewake/5820862 to your computer and use it in GitHub Desktop.
Save forcewake/5820862 to your computer and use it in GitHub Desktop.
[SuppressUnmanagedCodeSecurity]
internal static class SafeNativeMethods
{
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
public static extern int StrCmpLogicalW(string psz1, string psz2);
}
public sealed class NaturalStringComparer : IComparer<string>
{
public int Compare(string a, string b)
{
return SafeNativeMethods.StrCmpLogicalW(a, b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment