-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonConvert.DeserializeObject<Stack<T>>/JsonConvert.Serialize(Stack<T) does not work as expected. #971
Comments
I'm afraid this is a limition of a Stack. The results returned when it is serialized and the opposite order for when it is deserialized. |
How could this possibly be a limitation of the stack? The library should just convert to a list and reverse it before serializing. Or when deserializing, deserialize first to a list, reverse it, and create a stack from that list |
See? Easy as pie. Don't blame the built-in types, deal with them! EDIT: Actually the Stack constructor reverses the input stack, so |
This issue has not been fixed even in version 12.0.3. Sad. |
When I serialize a Stack of strings, or of anything else for that matter, and then try to deserialize it with the functions mentioned in the headline, I get a stack with reversed order. Is this unexpected behavior an intended feature? Then to get the expected behavior, I would have to write a specific code for handling stack?
Code that revealed this "feature":
The text was updated successfully, but these errors were encountered: