[API Proposal]: Add ReadOnlySequence<char> overload for WriteRawValue #102491
Labels
api-suggestion
Early API idea and discussion, it is NOT ready for implementation
area-System.Text.Json
Milestone
Background and motivation
In #68223, two overloads for
Utf8JsonWriter
were proposed, one forReadOnlySequence<byte>
and one forReadOnlySequence<char>
. The latter was rejected due to the necessary surrogate pair state handling while writing theReadOnlySpan<char>
segments.However, #67337 is currently underway to add the building blocks and state handling for that. Adding the rejected overload now seems like an easy addition.
API Proposal
namespace System.Text.Json { public sealed partial class Utf8JsonWriter { + public void WriteRawValue(ReadOnlySequence<char> json, bool skipInputValidation = false); } }
API Usage
I could avoid building an entire in-memory, contiguous string just to have it written out as JSON. Other proposals like #97570 or #87362 would tie in very nicely as well.
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: