On 2010/04/27 04:25, Jingle wrote:

     ArrayList al = new ArrayList();
     al.AddRange(new string[] { "Hello", "world", "this", "is", "a",
"test" });
     al.Sort();
     al.Reverse();
     Console.WriteLine(al.BinarySearch("this"));

It displays -7 . (yet when I add one more "al.Reverse()" into the
code, it displays 4 )

From the documentation (RTFM is good)
Return Value
The zero-based index of value in the sorted ArrayList, if value is found; otherwise, a negative number, which is the bitwise complement of the index of the next element that is larger than value or, if there is no larger element, the bitwise complement of Count.

--
Regards,
Mike Fry
Johannesburg


--
Subscription settings: 
http://groups.google.com/group/dotnetdevelopment/subscribe?hl=en

Reply via email to