5
Answers

Array.BinarySearch does not work

yogeshmanohar

yogeshmanohar

20y
2.1k
1
Hi!! I am having this strange problem. I have a sorted array containing strings. I am iterating through the array and clearing the contents one by one using "array.BinarySearch" to find each element. So far so good. But the moment I come to the last element, the BinarySearch method fails.It gives me a return value which is negative although the element is very much there. I am debugging through the code and I find nothing wrong with it.Note that i am using the first overloaded method of BinarySearch which accepts the name of the array and the value. Any little help would be highly appreciated since this is very very urgent. Thanks all of you in advance.
Answers (5)