G
Guest
I'm trying to do this-
....
void method1(System.Array arr)
{
// happen to know all elements in arr are int's
// this line throws an InvalidCastException
int[] intArr = (int[]) arr;
}
yes, it's asking a bit much to have it work with that simple of syntax, but
is there any way to downcast from a System.Array to a <specific type>[]
(e.g., int[]), as an alternative to creating a new specific type array, and
copying from the System.Array?
....
void method1(System.Array arr)
{
// happen to know all elements in arr are int's
// this line throws an InvalidCastException
int[] intArr = (int[]) arr;
}
yes, it's asking a bit much to have it work with that simple of syntax, but
is there any way to downcast from a System.Array to a <specific type>[]
(e.g., int[]), as an alternative to creating a new specific type array, and
copying from the System.Array?