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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top