w3resource
C# Sharp Programming Exercises

C# Sharp Exercises: Concatenate the array values of strings

C# Sharp String: Exercise-37 with Solution

Write a C# Sharp program to concatenate the array values of strings.

Expected Output :

Sample Solution:-

C# Sharp Code:

using System;
public class Example37
{
    public static void Main()
    {
        // Make an array of strings. Note that we have included spaces.
        string [] str = { "hello ", "welcome ", "to ", "C# Sharp ",
                        "create ", "Windows ", "client ", "applications "};

        // Put all the strings together.
        Console.WriteLine(string.Concat(str));

        // Sort the strings, and put them together.
        Array.Sort(str);
        Console.WriteLine(string.Concat(str));
    }
}

Sample Output:

hello welcome to C# Sharp create Windows client applications                                                  
                                                                                                              
hello applicationsC# Sharp client create to welcome Windows 

Flowchart :

Flowchart: C# Sharp Exercises - Concatenate the array values of strings

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: Write a C# Sharp program to concatenate three strings and display the result.
Next: Write a C# Sharp program to determine whether the string "birds" is a substring of a familiar.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming