-Added DateFormatHandling to control whether dates are written in the MS format or ISO format, with ISO as the default
-Added DateTimeZoneHandling to control reading and writing DateTime time zone details -Added reader/writer specific Formatting, DateFormatHandling and DateTimeZoneHandling to JsonSerializerSettings -Added feature of reader/writer specific settings to be set on JsonReader/JsonWriter when serializing -Added ReadAsDate to JsonReader -Added ReadAsString to JsonReader -Changed JsonTextReader to automatically read ISO strings as dates -Refactored ReadAsXXX methods and reduce code redundancy -Removed unused JsonDateTimeSerializationMode
This commit is contained in:
@@ -390,6 +390,30 @@ namespace Newtonsoft.Json
|
||||
return d;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the next JSON token from the stream as a <see cref="String"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="String"/>. This method will return <c>null</c> at the end of an array.</returns>
|
||||
public override string ReadAsString()
|
||||
{
|
||||
string s = _reader.ReadAsString();
|
||||
|
||||
ValidateCurrentToken();
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the next JSON token from the stream as a <see cref="Nullable{DateTime}"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="String"/>. This method will return <c>null</c> at the end of an array.</returns>
|
||||
public override DateTime? ReadAsDateTime()
|
||||
{
|
||||
DateTime? dateTime = _reader.ReadAsDateTime();
|
||||
|
||||
ValidateCurrentToken();
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
/// <summary>
|
||||
/// Reads the next JSON token from the stream as a <see cref="Nullable{DateTimeOffset}"/>.
|
||||
|
||||
Reference in New Issue
Block a user