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

◆ TryGetSingle()

bool System.Text.Json.Utf8JsonReader.TryGetSingle ( out float value)
inline

Definition at line 4684 of file Utf8JsonReader.cs.

4685 {
4686 if (TokenType != JsonTokenType.Number)
4687 {
4688 throw ThrowHelper.GetInvalidOperationException_ExpectedNumber(TokenType);
4689 }
4690 ReadOnlySpan<byte> readOnlySpan;
4691 if (!HasValueSequence)
4692 {
4694 }
4695 else
4696 {
4699 }
4700 ReadOnlySpan<byte> source = readOnlySpan;
4701 if (Utf8Parser.TryParse(source, out float value2, out int bytesConsumed, '\0') && source.Length == bytesConsumed)
4702 {
4703 value = value2;
4704 return true;
4705 }
4706 value = 0f;
4707 return false;
4708 }
static bool TryParse(ReadOnlySpan< byte > source, out bool value, out int bytesConsumed, char standardFormat='\0')
ReadOnlySequence< byte > ValueSequence

References System.Text.Json.Dictionary, System.Text.Json.ThrowHelper.GetInvalidOperationException_ExpectedNumber(), System.Text.Json.Utf8JsonReader.HasValueSequence, System.source, System.Buffers.Text.Utf8Parser.TryParse(), System.value, System.Text.Json.Utf8JsonReader.ValueSequence, and System.Text.Json.Utf8JsonReader.ValueSpan.

Referenced by System.Text.Json.Utf8JsonReader.GetSingle().