Split off from https://github.com/dotnet/corefx/issues/33320#issuecomment-437046345.
We already have the following "convert to .NET type" APIs on Utf8JsonReader:
public ref partial struct Utf8JsonReader
{
// These throw InvalidOperationException if there is a token type mismatch
public string GetStringValue();
public bool GetBooleanValue();
// These throw InvalidOperationException if there is a token type mismatch (i.e. not JsonTokenType.Number).
public bool TryGetInt32Value(out int value);
public bool TryGetInt64Value(out long value);
public bool TryGetSingleValue(out float value);
public bool TryGetDoubleValue(out double value);
public bool TryGetDecimalValue(out decimal value);
}
Add the following:
public ref partial struct Utf8JsonReader
{
// This throws InvalidOperationException if there is a token type mismatch (i.e. not JsonTokenType.Number).
public bool TryGetBigIntegerValue(out BigInteger value);
// This throw InvalidOperationException if there is a token type mismatch.
// This throw OverflowException if the number isn't an integer.
public BigInteger GetBigIntegerValue();
}
Split off from https://github.com/dotnet/corefx/issues/33320#issuecomment-437046345.
We already have the following "convert to .NET type" APIs on Utf8JsonReader:
Add the following: