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.
5
solved How to print array in format [1, 2, 3, 4 ,5] with string.Join in C#?