Improve anonymous-type ToString #2516
Replies: 11 comments
-
This would be a breaking change I'm afraid. |
Beta Was this translation helpful? Give feedback.
-
So I thought, but is there any possible use with the current version at all other then debug info? |
Beta Was this translation helpful? Give feedback.
-
It is possible that people parse them, and create objects that way. |
Beta Was this translation helpful? Give feedback.
-
Any room to consider improving it although it being a breaking change? |
Beta Was this translation helpful? Give feedback.
-
It's not me you would have to convince - it's the LDC. IMO, something like this is the sort of thing that would be ultra low priority even if it wasn't a breaking change. They already have a near infinite backlog. However if a community member were to implement it, they would consider it. Given that it is a breaking change, that means that whatever happens, they have to be investigate how many people this would break, which means they're just going to ignore it, and do other things instead. |
Beta Was this translation helpful? Give feedback.
-
This request is inconsistent with the fact that |
Beta Was this translation helpful? Give feedback.
-
I don't think this would actually be a language change, since the spec does not prescribe the implementation of But if this was considered to be an unacceptable behavioral breaking change, that would still be a problem. |
Beta Was this translation helpful? Give feedback.
-
Not a language feature, but you could ask for a change to |
Beta Was this translation helpful? Give feedback.
-
why not use extension like public static string ToJson(this object o) => JsonConvert.SerializeObject(o) if anybody wants his own specific format then he should use his own formatter |
Beta Was this translation helpful? Give feedback.
-
Getting a useful format for |
Beta Was this translation helpful? Give feedback.
-
I think adding a (You could also implement That means you can write your own type which implements It also means that people can pass in things like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
When calling
ToString
of C#'s anonymous types, a dictionary-like string is produced, for example:Will output a string containing:
{ str = "sdf", char = 'a', i = 45, b = False }
.My request is that it should output more precise results, for instance, string and char values should be wrapped in quotes, and booleans should be lowercase.
Beta Was this translation helpful? Give feedback.
All reactions