S
ssg31415926
I need to cast a string[] into an object[] and vice versa.
At the moment, I'm using code like this:
int numOfObjects = Values.Length;
object[] objects = new object[numOfObjects];
for(int i = 0; i < numOfObjects; i++) {
objects = (object)Values;
}
where Values is a string[] passed to the member doing the conversion.
It works but it seems clunky. I feel there should be an easier way.
Is there?
At the moment, I'm using code like this:
int numOfObjects = Values.Length;
object[] objects = new object[numOfObjects];
for(int i = 0; i < numOfObjects; i++) {
objects = (object)Values;
}
where Values is a string[] passed to the member doing the conversion.
It works but it seems clunky. I feel there should be an easier way.
Is there?