Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does c# convert an int array into a string array?
How does c# convert an int array into a string array?
First of all, you know how int is converted into string:

With toString?

int varInt = 1; ?

string varString2 = varInt。 ToString();

Or Convert.toString ()

int varInt = 1; ?

String varString = Convert. ToString(varInt); ?

According to the above transformation, we can realize the transformation of the array:

int[] a 1 = { 9,8,7 };

String[] a2 = new string [3];

for(int I = 0; I<a 1. Length; i++)

a2[i] = a 1[i]。 ToString();

//Use this sentence under C # 3.0.

intArray = Array。 ConvertAll & ltstring, int & gt(strArray, s =>);

//Replace the above example with the following statement under 2.0.

//intArray = Array。 ConvertAll & ltstring,int & gt(strArray,delegate (string s) { return int。 Analysis; } );