JsonElement.TryGetSingle(Single) Método

Definição

Tenta representar o número JSON atual como um Single.Attempts to represent the current JSON number as a Single.

public:
 bool TryGetSingle([Runtime::InteropServices::Out] float % value);
public bool TryGetSingle (out float value);
member this.TryGetSingle : single -> bool
Public Function TryGetSingle (ByRef value As Single) As Boolean

Parâmetros

value
Single

Quando esse método é retornado, ele contém o valor de ponto flutuante de precisão simples equivalente ao número JSON atual.When this method returns, contains the single-precision floating point value equivalent to the current JSON number.

Retornos

Boolean

true se o número puder ser representado como um Single; caso contrário, false.true if the number can be represented as a Single; otherwise, false.

Exceções

O ValueKind desse valor não é Number.This value's ValueKind is not Number.

O JsonDocument pai foi descartado.The parent JsonDocument has been disposed.

Comentários

Esse método não analisa o conteúdo de um valor de cadeia de caracteres JSON.This method does not parse the contents of a JSON string value.

No .NET Core, esse método não retorna false valores maiores Single.MaxValue ou menores que Single.MinValue ).On .NET Core, this method does not return false for values larger than Single.MaxValue or smaller than Single.MinValue). Em vez disso, ele retorna true e atribui Single.PositiveInfinity ou Single.NegativeInfinity ao value argumento.Instead, it returns true and assigns Single.PositiveInfinity or Single.NegativeInfinity to the value argument.

Aplica-se a