protected double RequireDouble() { sb.Clear(); var ch = SkipSpaces(); bool neg = ch == '-'; if (neg) { sb.Append(ch); ch = Reader.ReadChar(); } if (ch == 'N') { Require("aN"); return(double.NaN); } if (ch == 'I') { Require("nfinity"); return(neg ? double.NegativeInfinity : double.PositiveInfinity); } ch = JsonNumberReader.ReadUnsignedFloat(Reader, sb, ch); PutBack(ch); return(double.Parse(sb.ToString(), CultureInfo.InvariantCulture)); }
protected decimal RequireDecimal() { sb.Clear(); var ch = SkipSpaces(); bool neg = ch == '-'; if (neg) { sb.Append(ch); ch = Reader.ReadChar(); } ch = JsonNumberReader.ReadUnsignedFloat(Reader, sb, ch); PutBack(ch); return(decimal.Parse(sb.ToString(), CultureInfo.InvariantCulture)); }