-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add deserialization examples demonstrating child collection iteration #50338
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses a documentation gap by adding iteration code to demonstrate that child collections are properly populated during JSON deserialization. The changes enhance the deserialization examples with code that iterates through IList<DateTimeOffset>, Dictionary<string, HighLowTemps>, and string[] collections to prove they were successfully deserialized.
Key changes:
- Added iteration logic to the C# deserialization example that prints all child collection elements
- Created a new VB equivalent demonstrating the same functionality
- Updated documentation to reference the new VB example and clarify the example's purpose
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
docs/standard/serialization/system-text-json/snippets/how-to/vb/DeserializeExtra.vb |
New Visual Basic example file showing deserialization with child collection iteration |
docs/standard/serialization/system-text-json/snippets/how-to/csharp/DeserializeExtra.cs |
Added iteration code for child collections and updated output comments |
docs/standard/serialization/system-text-json/deserialization.md |
Updated to reference new VB example and clarified description |
docs/standard/serialization/system-text-json/snippets/how-to/csharp/SerializeExtra.cs |
Modernized collection initialization syntax using collection expressions |
docs/standard/serialization/system-text-json/snippets/how-to/csharp/Program.cs |
Test-related changes that should be reverted |
| //SerializeWithGenericParameter.Program.Main(); | ||
| //SerializeWriteIndented.Program.Main(); | ||
| //SerializeExtra.Program.Main(); | ||
| SerializeExtra.Program.Main(); |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change uncomments SerializeExtra.Program.Main() and comments out SerializeEnumCustomName.Run() on line 48. These appear to be test-related changes that should not be included in the PR. Please revert these changes to maintain the original state of the Program.cs file.
Summary
The deserialization examples showed JSON being deserialized into complex objects with collections and nested types, but only printed top-level properties. This left users uncertain whether child collections (
IList<DateTimeOffset>,Dictionary<string, HighLowTemps>,string[]) were actually populated.Changes:
DeserializeExtra.cs): Added iteration code that prints all child collection elementsDeserializeExtra.vb): Created new file matching C# functionality with equivalent iteration logicdeserialization.md): Updated to reference new VB example and clarified descriptionBefore:
After:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Internal previews