I've tried searching for this and I suspect I'm not asking the question in the right way but I am curious--apart from the obvious differences, what's the difference between charArray.ToString()
and new String(charArray)
?
This is what I'm talking about:
var cArray = new char[]{'a','b','c'};
var a = cArray.ToString();
var a2 = new String(cArray);
Console.WriteLine($"{a}");
// -> System.Char[]
Console.WriteLine($"{a2}");
// -> abc
Why doesn't cArray.ToString()
give me back a string?