Skip to content

Add Stack<T> converter example #16690

@tdykstra

Description

@tdykstra

Add example converter that serializes Stack objects without reversing the order.

#16225 (comment)

Start the new section with text that was in the Migrate doc:

In <xref:System.Text.Json>, the order of a stack's contents is reversed when it's serialized.
This behavior applies to the following types and interface and user-defined types that
derive from them:	
* <xref:System.Collections.Stack>	
* <xref:System.Collections.Generic.Stack%601>	
* <xref:System.Collections.Immutable.ImmutableStack%601>	
* <xref:System.Collections.Immutable.IImmutableStack%601>	
A custom converter could be implemented to keep stack contents in the same order.

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions