"AMP" <am******@gmail.comwrote in message
news:0e**********************************@u12g2000 prd.googlegroups.com...
I want to convert a string Array permanantly to a int Array.
Everywhere in my code I have to use Convert.ToInt32 to use the data. I
just want to change it once.
The array cannot change types on the fly. You wil have to allocate a new
int Array, convert all the strings from the string array into the int array,
and then deallocate the string array. The simplest, although maybe not the
prettiest way to write it, is a loop that converts each element:
string[] theStrings = ...;
int[] theInts new int[theStrings.Length];
for (int i=0; i<theStrings.Length; i++)
theInts[i]=int.Parse(theStrings[i]);