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

◆ GetUnescapedSpan()

static ReadOnlySpan< byte > System.Text.Json.JsonReaderHelper.GetUnescapedSpan ( ReadOnlySpan< byte > utf8Source,
int idx )
inlinestatic

Definition at line 349 of file JsonReaderHelper.cs.

350 {
351 int length = utf8Source.Length;
352 byte[] array = null;
353 Span<byte> span = ((length > 256) ? ((Span<byte>)(array = ArrayPool<byte>.Shared.Rent(length))) : stackalloc byte[256]);
354 Span<byte> destination = span;
356 ReadOnlySpan<byte> result = destination.Slice(0, written).ToArray();
357 if (array != null)
358 {
359 new Span<byte>(array, 0, written).Clear();
361 }
362 return result;
363 }
static ArrayPool< T > Shared
Definition ArrayPool.cs:7

References System.array, System.Span< T >.Clear(), System.destination, System.Text.Json.Dictionary, System.length, System.Buffers.ArrayPool< T >.Shared, System.ReadOnlySpan< T >.Slice(), and System.Unescape.

Referenced by System.Text.Json.JsonSerializer.GetPropertyName(), and System.Text.Json.Utf8JsonReader.GetUnescapedSpan().