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

◆ CreateForLiteral()

static JsonDocument System.Text.Json.JsonDocument.CreateForLiteral ( JsonTokenType tokenType)
inlinestaticprivate

Definition at line 1389 of file JsonDocument.cs.

1390 {
1391 switch (tokenType)
1392 {
1393 case JsonTokenType.False:
1394 if (s_falseLiteral == null)
1395 {
1396 s_falseLiteral = Create(JsonConstants.FalseValue.ToArray());
1397 }
1398 return s_falseLiteral;
1399 case JsonTokenType.True:
1400 if (s_trueLiteral == null)
1401 {
1402 s_trueLiteral = Create(JsonConstants.TrueValue.ToArray());
1403 }
1404 return s_trueLiteral;
1405 default:
1406 if (s_nullLiteral == null)
1407 {
1408 s_nullLiteral = Create(JsonConstants.NullValue.ToArray());
1409 }
1410 return s_nullLiteral;
1411 }
1413 {
1414 MetadataDb parsedData = MetadataDb.CreateLocked(utf8Json.Length);
1415 parsedData.Append(tokenType, 0, utf8Json.Length);
1416 return new JsonDocument(utf8Json, parsedData);
1417 }
1418 }
static JsonDocument s_falseLiteral
static JsonDocument s_nullLiteral
JsonDocument(ReadOnlyMemory< byte > utf8Json, MetadataDb parsedData, byte[] extraRentedArrayPoolBytes=null, PooledByteBufferWriter extraPooledByteBufferWriter=null, bool isDisposable=true)
static JsonDocument s_trueLiteral

References System.Text.Json.JsonDocument.JsonDocument(), System.IO.Create, System.Text.Json.JsonDocument.MetadataDb.CreateLocked(), System.Text.Json.Dictionary, System.Text.Json.JsonConstants.FalseValue, System.Text.Json.JsonConstants.NullValue, System.Text.Json.JsonDocument.s_falseLiteral, System.Text.Json.JsonDocument.s_nullLiteral, System.Text.Json.JsonDocument.s_trueLiteral, and System.Text.Json.JsonConstants.TrueValue.

Referenced by System.Text.Json.JsonDocument.TryParseValue().