Does Array.ToString() provide a useful output?
You can certainly do that, but it's not the default behaviour. The easiest way to do that (from .NET 3.5 anyway) is probably:
string joined = string.Join(",", array.Select(x => x.ToString()).ToArray());
MoreLINQ has a built-in method to do this:
string joined = array.ToDelimitedString();
or specify the delimited explicitly:
string joined = array.ToDelimitedString(",");
Option 1
If you have an array of string
s, then you can use String.Join
:
string[] values = ...;
string concatenated = string.Join(",", values);
Option 2
If you're dealing with an array of any other type and you're using .NET 3.5 or above, you can use LINQ:
string concatenated = string.Join(",",
values.Select(x => x.ToString()).ToArray());