Hi All,
I'm learning MCTS 70-536. These are some codes from Chapter 4:

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

It displays 2 . but when I change the code to this:

    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 )

I've tested that only the code above gets a nagative number, other
groups by some "al.Sort" and some "al.Reverse" all display a right
number.
Anyone who can help to explain ? Thanks!


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

Reply via email to