Problem with object to array convertion

  • Thread starter Thread starter Jeroen Ceuppens
  • Start date Start date
J

Jeroen Ceuppens

I get an object from a function (tt.array1_10), it is a 2dim array

I do this
object o=new object();

o=tt.array1_10; (you can see through quickwatch the correct values in the
"array" o)



But you can't do this:

o[0,0] => compiler tells: o is object not object[*,*]



Is there a way to copy the content of an object to an array??

Thx

Greetz

JC
 
You need to cast it back to the array type you used to begin with.

If the Array is an int[,] you would use
int result = ((int[,])o)[0,0]
 
Back
Top