Array.BinarySearch does not find item using IComparable
- by Sir Psycho
If a binary search requires an array to be sorted before hand, why does the following code work?
string[] strings = new[] { "z", "a", "y", "e", "v", "u" };
int pos = Array.BinarySearch(strings, "Y", StringComparer.OrdinalIgnoreCase);
Console.WriteLine(pos);
And why does this code result return -1?
public class Person :…