tags:

views:

38

answers:

2

I have an int array with the value 3,99,6. How do i convert the array into the string 3,99,6 with linq?

+4  A: 
string s = string.Join(", ", list.Select(x => x.ToString()).ToArray());
Stefan Steinegger
+3  A: 

Stefan's solution is correct, and pretty much required for .NET 3.5. In .NET 4, there's an overload of String.Join which takes an IEnumerable<string> so you can use:

string s = string.Join(",", list.Select(x => x.ToString());
Jon Skeet
*very* good to know when i switch to 4
acidzombie24