Closed
Description
EDIT: see #86442 (comment) for API proposal.
Original Proposal
I would like System.Text.Json to serialize/deserialize Memory/ReadOnlyMemory<T>
using the same logic as it uses for T[]
.
This implies:
Memory<byte>
should be base64-encoded just likebyte[]
isMemory<FooBar>
should be serialized as appropriate for the typeFooBar
, same asFooBar[]
would.
The main motivation is that I have an array from ArrayPool<T>.Shared
, which can have space for more items than I actually need. To serialize only a segment of the array, I would like to use Memory<T>
to identify only use "used" part of the array.