Best way to Convert Int[] array to string and string to int[] in .net Compact framework 2.0 through VS2005

1.1k views Asked by At

I have an integer array that looks like

int[] arr= new int[] {1,2,3,4};

and i want to convert this into a string like

string str="1,2,3,4";

and vice verse in .net Compact framework 2.0.

I have tried using string.join and Array.convertAll to conver int array to string. But it is not working in .Net Compact Framework 2.0.

What is the best and fastest way of doing this in .net Compact framework 2.0?

1

There are 1 answers

0
w.b On BEST ANSWER

Check if this works:

int[] arr = new int[] { 1, 2, 3, 4 };

string[] strArr = new string[4];

for (int i = 0; i < arr.Length; i++)
    strArr[i] = arr[i].ToString();

string newStr = String.Join(",", strArr);