The Join() Method is used to join all the elements of an array into one string.
public class MyApplication
{
public static void Main(string[] args)
{
string[] x = {"Hello", "Beautiful", "World"};
string y = string.Join("@", x);
System.Console.WriteLine(y);
}
}
In the above code, we have declared an array with values Hello, Beautiful and World. And assigned it to a variable x.
string[] x = {"Hello", "Beautiful", "World"};-Method1.png)
Then we have used the Join() function to take all the three values from the array and join them, separated using @.
string y = string.Join("@", x);-Method2.png)