Add stream-based API and WriteToString() methods to FluentXmlWriter#15
Draft
Add stream-based API and WriteToString() methods to FluentXmlWriter#15
Conversation
…) methods Co-authored-by: jtenos <607782+jtenos@users.noreply.github.com>
…t multiple Done() calls Co-authored-by: jtenos <607782+jtenos@users.noreply.github.com>
…t internally Co-authored-by: jtenos <607782+jtenos@users.noreply.github.com>
Co-authored-by: jtenos <607782+jtenos@users.noreply.github.com>
Co-authored-by: jtenos <607782+jtenos@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Break down functionality into streamed and output versions
Add stream-based API and WriteToString() methods to FluentXmlWriter
Dec 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements two distinct usage patterns: stream-based writing with explicit completion via
Done(), andWriteToString()methods as cleaner alternatives toOutputToString().Changes
Stream-based API
Start(TextWriter, topLevelElement, FormattingOptions?)- writes directly to provided writerStart(Stream, topLevelElement, FormattingOptions?, Encoding?)- creates internal StreamWriterDone()- flushes and disposes stream (only disposes when we own the TextWriter)OutputToString()/OutputToFile()in stream modeDone()calls with_isDoneflagWriteToString() methods
WriteToString(),WriteToString(bool),WriteToString(FormattingOptions)OutputToString()implementationInternal changes
CustomXmlWriteraccepts anyTextWriter(not justStringWriter)_isStreamModeand_ownsTextWriterflags control behavior and disposalExamples
Stream-based writing:
String output:
All existing API methods remain unchanged and functional. Added 16 tests covering new functionality.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.