I want to turn an array or list of ints into a comma delimited string, like this:
string myFunction(List<int> a) {
return string.Join(",", a);
}
But string.Join only takes List<string> as the second parameter. What is the best way to do this?
The best way is to upgrade to .NET 4.0 or later where there is an overload that does what you want:
String.Join<T>(String, IEnumerable<T>)If you can’t upgrade, you can achieve the same effect using Select and ToArray.