.ToString
on an array does not stringify its contents CS-W1020The general expectation is that the .ToString
method return an appropriate string
that best represents an entity. However, calling the said method on an array does not stringify its contents. Rather, it returns a string that represents its type. If your intention is to stringify the array, it is suggested that you use other alternatives such as string.Join()
.
Console.WriteLine(new int[]{1, 2, 3, 4, 5}.ToString()); // Prints `System.Int32[]`
Console.WriteLine(String.Join(", ", new int[]{1, 2, 3, 4, 5})); // Prints `1, 2, 3, 4, 5`