Something like
char[] a = new char[] { 'a', 'b', 'c', 'd' };<br>
Console.WriteLine(a);
works nicely with C#.
If the type of the array is integer this does not work any longer.
It has to be coded as
for (int k = 0; k < a.Length; k++) Console.Write(a[k]); Console.WriteLine();
This looks rather lame to me. Is there a more succinct way to do so?
For example some way which expands WriteLine(a) in a loop-free way to
WriteLine("{0},{1},{2},...,{a.Length-1}", a[0],a[1],a[2],...,a[a.Length-1]);
Perhaps there is some neat Linq trick?
How about
String.Join?Beginning with
.Net Framework 4, the second argument is anobject[]:Trying a snippet in Visual Studio 2010, targeting framework 4:
Produces: