0

I have managed to get a list of names from a database, join the first and last name, put these names into an array so that they can be called up in say a MessageBox. How do I place the values from a dynamic string array into a string variable preferably separated by commas.

Here is my code so far:

        string[] array = new string[size];
        for (int i = 0; i < size; i++)
        {
            array[i] = Join(fullname);
        }


        foreach (string i in array)
        {
            MessageBox.Show(i);
        } 
palm-alchemist
  • 113
  • 1
  • 2
  • 11

1 Answers1

1

Use string.Join:

var myString = string.Join(",", array);
Maksim Simkin
  • 9,561
  • 4
  • 36
  • 49