Implementing custom IComparer with string
This should do what you want: var example = new string[]{“c”, “a”, “d”, “b”}; var comparer = new CustomStringComparer(StringComparer.CurrentCulture); Array.Sort(example, comparer); … class CustomStringComparer : IComparer<string> { private readonly IComparer<string> _baseComparer; public CustomStringComparer(IComparer<string> baseComparer) { _baseComparer = baseComparer; } public int Compare(string x, string y) { if (_baseComparer.Compare(x, y) == 0) return 0; // “b” … Read more