Moose Factory Moose Factory - 9 months ago 52
C# Question

Convert a string array to a concantenated string in C#

Is there an easy way to convert a string array into a concantenated string?

For example, I have a string array:

new string[]{"Apples", "Bananas", "Cherries"};

And I want to get a single string:



Answer Source

A simple one...

string[] theArray = new string[]{"Apples", "Bananas", "Cherries"};
string s = string.Join(",",theArray);