convert a char[] to an object[] and back

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I am trying to write a routine to do a generic operation on an array
dostuff(object []). But I have come across a problem. If I use a value
type array I cannot cast it to an object[]. Is there some way of doing
this? I guess you would have to box all the values in the array
individually seems like this could become expensive

Tom
 
Tom said:
I am trying to write a routine to do a generic operation on an array
dostuff(object []). But I have come across a problem. If I use a value
type array I cannot cast it to an object[]. Is there some way of doing
this? I guess you would have to box all the values in the array
individually seems like this could become expensive

Yes, that would be quite painful, but it's the only way of working if
you really need to pass it as object[]. Could you pass it as Array
instead, perhaps?
 

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