Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created June 24, 2022 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/dc263dbb8bdc2c829632ec04f6837c71 to your computer and use it in GitHub Desktop.
Save lgolubyev/dc263dbb8bdc2c829632ec04f6837c71 to your computer and use it in GitHub Desktop.
int valueLength = reader.HasReadOnlySequence ? checked((int)ValueSequence.Length) : ValueSpan.Length;
char[] buffer = ArrayPool<char>.Shared.Rent(valueLength);
int charsRead = reader.CopyString(buffer);
ReadOnlySpan<char> source = buffer.Slice(0, charsRead);
ParseUnescapedString(source); // handle the unescaped JSON string
ArrayPool<char>.Shared.Return(buffer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment