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?
 
Back
Top