Q:

How to print array in format [1, 2, 3, 4 ,5] with string.Join in C#?

i have an array 1 2 3 4 5 in C#. I just want to print in format with: [] ; 
Ex. [1, 2, 3, 4, 5]

A:

You can use string.Format and string.Join combined
var output = string.Format("[{0}]", string.Join(",", yourArray));

and then you just need to print output string anywhere you want.
String.Format will provide you with possibility to wrap joined string with [ and ] without concatenating string manually.

