why doesn't c# list<>
's tostring
method provide sensible string representation prints contents? class name (which assume default object.tostring
implementation) when try print list<>
object. why so?
the simple answer is: that's way is, i'm afraid.
likewise list<t>
doesn't override gethashcode
or equals
. note have little way of formatting pleasantly other call simple tostring
itself, perhaps comma-separating values.
you write own extension method perform appropriate formatting if want, or use newer overloads of string.join
make pretty simple:
string text = string.join(",", list);
Comments
Post a Comment