Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ValueTextEquals() [2/3]

unsafe bool System.Text.Json.Utf8JsonReader.ValueTextEquals ( ReadOnlySpan< char > text)
inline

Definition at line 324 of file Utf8JsonReader.cs.

325 {
326 if (!IsTokenTypeString(TokenType))
327 {
328 throw ThrowHelper.GetInvalidOperationException_ExpectedStringComparison(TokenType);
329 }
330 if (MatchNotPossible(text.Length))
331 {
332 return false;
333 }
334 byte[] array = null;
335 int num = checked(text.Length * 3);
336 Span<byte> utf8Destination;
337 if (num > 256)
338 {
339 array = ArrayPool<byte>.Shared.Rent(num);
341 }
342 else
343 {
344 byte* pointer = stackalloc byte[256];
345 utf8Destination = new Span<byte>(pointer, 256);
346 }
347 ReadOnlySpan<byte> utf16Source = MemoryMarshal.AsBytes(text);
348 int bytesConsumed;
349 int bytesWritten;
352 if (array != null)
353 {
354 utf8Destination.Slice(0, bytesWritten).Clear();
356 }
357 return result;
358 }
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
bool MatchNotPossible(int charTextLength)
static bool IsTokenTypeString(JsonTokenType tokenType)
bool TextEqualsHelper(ReadOnlySpan< byte > otherUtf8Text)

References System.array, System.Text.Json.Dictionary, System.Text.Json.ThrowHelper.GetInvalidOperationException_ExpectedStringComparison(), System.Text.Json.Utf8JsonReader.IsTokenTypeString(), System.Text.Json.Utf8JsonReader.MatchNotPossible(), System.pointer, System.Buffers.ArrayPool< T >.Shared, System.text, System.Text.Json.Utf8JsonReader.TextEqualsHelper(), and System.Text.Json.JsonWriterHelper.ToUtf8().