Moose Factory Moose Factory - 1 year ago 104
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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download