You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We already have string-based overloads along with UTF-8 byte span overloads. We should add ReadOnlySpan<char> based overloads too to avoid forcing folks who already have string span slices to unnecessary call ToString().
It is arguable that the string overload was mainly added for usability and folks who care about performance should really be using the UTF-8 overloads instead of us adding ReadOnlySpan<char> overloads (essentially, wherever they got the string/UTF-16 span from, they should replace try to get the UTF-8 bytes or stream instead). For example, instead of doing File.ReadAllText, pass in the FileStream directly.
However, we have added such overloads to APIs that accept string elsewhere, and there is still value for scenarios where the input JSON cannot be changed to something other than string.
The text was updated successfully, but these errors were encountered:
We already have string-based overloads along with UTF-8 byte span overloads. We should add
ReadOnlySpan<char>
based overloads too to avoid forcing folks who already have string span slices to unnecessary callToString()
.On such use case is in https://stackoverflow.com/questions/58845880/how-to-deserialize-readonlyspanchar-to-object-using-system-text-json
Add:
Existing:
It is arguable that the string overload was mainly added for usability and folks who care about performance should really be using the UTF-8 overloads instead of us adding
ReadOnlySpan<char>
overloads (essentially, wherever they got the string/UTF-16 span from, they should replace try to get the UTF-8 bytes or stream instead). For example, instead of doingFile.ReadAllText
, pass in theFileStream
directly.However, we have added such overloads to APIs that accept string elsewhere, and there is still value for scenarios where the input JSON cannot be changed to something other than string.
The text was updated successfully, but these errors were encountered: