E
Eric Eggermann
Thanks for the help last week, but I've got a new problem with a different
array now.....sigh.
I want to use an ArrayList to hold unique integer arrays. I've written a
comparer class which works when I call the function explicitly, but when I
use the Sort and BinarySearch functions of my ArrayList object I get
InvalidCast exceptions.
public int Compare(object x, object y)
{
return Compare((Array)x, (Array)y); //InvalidCast exception here
}
public int Compare(Array x, Array y)
{
.... comparison code here is working....
}
Of course, the ArrayList only contains int[] arrays. Also, the above code is
just one of many equally useless tries I've had at this. How do I cast
between an object reference and an array of ints, so that I can use my
comparer with ArrayList.Sort and BinarySearch functions?
All ideas well appreciated,
Eric
array now.....sigh.
I want to use an ArrayList to hold unique integer arrays. I've written a
comparer class which works when I call the function explicitly, but when I
use the Sort and BinarySearch functions of my ArrayList object I get
InvalidCast exceptions.
public int Compare(object x, object y)
{
return Compare((Array)x, (Array)y); //InvalidCast exception here
}
public int Compare(Array x, Array y)
{
.... comparison code here is working....
}
Of course, the ArrayList only contains int[] arrays. Also, the above code is
just one of many equally useless tries I've had at this. How do I cast
between an object reference and an array of ints, so that I can use my
comparer with ArrayList.Sort and BinarySearch functions?
All ideas well appreciated,
Eric