Convert a comma delimited string to an array and Convert Array into comma delimited string

By karan patel

Here i will give you code for converting a comma delimited string to an array and Array into comma delimited string.

            // Convert Array into comma delimited string
            string[] array = { "Hello","How","are","you" };
            string Seperator = ",";
            String Joined_str = String.Join(Seperator, array);
             MessageBox.Show("Joined string from array is : " + Joined_str);


             // convert string into array.

             string[] array2 = Joined_str.Split(',');
            foreach(string s in array2)
             {
                 MessageBox.Show(s);
            }

Convert a comma delimited string to an array and Convert Array into comma delimited string  (946 Views)