If I have an array and perform a ToString()
does that just string together the array values in one long comma seperated string or is that not possible on an array?
If I have an array and perform a ToString()
does that just string together the array values in one long comma seperated string or is that not possible on an array?
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());