public int Compare(string x, string y) { var xi = ourSpecialNames.IndexOf(x); var yi = ourSpecialNames.IndexOf(y); // -1 -> x is less than y, so goes to top if (xi == -1 && yi > -1) { return(1); } if (xi > -1 && yi == -1) { return(-1); } if (xi == -1 && yi == -1) { return(string.Compare(x, y, StringComparison.InvariantCulture)); } return(xi > yi ? 1 : (xi < yi ? -1 : 0)); }