C# string comma separated to integer array

this C# function will convert an comma separated string in to an array of integers private int[] commaStrToArray(string strIntComma) { string [] strArray; strArray = strIntComma.Split(new char[] {','}); int [] intArray = new int [strArray.Length]; for (int i = 0; i < strArray.Length; i++) intArray[i] = int.Parse(strArray[i]); return intArray; }

Comments

Convert integer array to string comma separated

this is the way to revert the code above (convert a [b]int array into a string of comma[/b] separeted private string arrayToCommaStr(int[] intArray) { string comma = ""; string strOut = ""; foreach (int i in intArray) { strOut += comma + i.ToString(); comma = ","; } return strOut; }