Question regarding C#'s `List<>.ToString` -


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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -