Question regarding C#’s `List.ToString`

The simple answer is: that’s just the way it is, I’m afraid.

Likewise List<T> doesn’t override GetHashCode or Equals. Note that it would have very little way of formatting pleasantly other than to call the simple ToString itself, perhaps comma-separating the values.

You could always write your own extension method to perform appropriate formatting if you want, or use the newer overloads of string.Join which make it pretty simple:

string text = string.Join(",", list);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)