We can use String.Join method to create a new string from an array of string. Let’ say I have a array of the some words and i want to create a sentence from this array then i can use The String.Join method with an array and a separator string. It places the separator(we are using a blank space in the example) string between each element of the array in the returned string.
string[] strArray = { "Welcome", "to", "Author", "Code" }; string NewString = String.Join(" ", strArray); MessageBox.Show(NewString);
Let’s examine the above code closely. The first statement declares a new string[] array with four elements. And in second line we are using the String.Join method. In third line we are showing the result in a message box.