-Fixed reading scientific notation numbers with no decimal point

-Changed the ReadAsXXX methods to return null at the end of an array instead of throwing an error
This commit is contained in:
JamesNK
2012-02-18 01:04:50 +00:00
parent 446b6f0d0a
commit c876e1d9cc
9 changed files with 163 additions and 88 deletions
+4 -15
View File
@@ -102,14 +102,8 @@ namespace Newtonsoft.Json
private char _quoteChar;
internal State _currentState;
private JTokenType _currentTypeContext;
private bool _serializerInArray;
private CultureInfo _culture;
internal void SetSerializeInArray(bool serializerInArray)
{
_serializerInArray = serializerInArray;
}
/// <summary>
/// Gets the current reader state.
/// </summary>
@@ -235,26 +229,26 @@ namespace Newtonsoft.Json
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{Int32}"/>.
/// </summary>
/// <returns>A <see cref="Nullable{Int32}"/>.</returns>
/// <returns>A <see cref="Nullable{Int32}"/>. This method will return <c>null</c> at the end of an array.</returns>
public abstract int? ReadAsInt32();
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="T:Byte[]"/>.
/// </summary>
/// <returns>A <see cref="T:Byte[]"/> or a null reference if the next JSON token is null.</returns>
/// <returns>A <see cref="T:Byte[]"/> or a null reference if the next JSON token is null. This method will return <c>null</c> at the end of an array.</returns>
public abstract byte[] ReadAsBytes();
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{Decimal}"/>.
/// </summary>
/// <returns>A <see cref="Nullable{Decimal}"/>.</returns>
/// <returns>A <see cref="Nullable{Decimal}"/>. This method will return <c>null</c> at the end of an array.</returns>
public abstract decimal? ReadAsDecimal();
#if !NET20
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{DateTimeOffset}"/>.
/// </summary>
/// <returns>A <see cref="Nullable{DateTimeOffset}"/>.</returns>
/// <returns>A <see cref="Nullable{DateTimeOffset}"/>. This method will return <c>null</c> at the end of an array.</returns>
public abstract DateTimeOffset? ReadAsDateTimeOffset();
#endif
@@ -434,11 +428,6 @@ namespace Newtonsoft.Json
}
}
internal bool ReaderIsSerializerInArray()
{
return (TokenType == JsonToken.EndArray && _serializerInArray);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>