-Xml documentation
This commit is contained in:
@@ -1,8 +1,17 @@
|
|||||||
namespace Newtonsoft.Json
|
namespace Newtonsoft.Json
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies how dates are formatted when writing JSON text.
|
||||||
|
/// </summary>
|
||||||
public enum DateFormatHandling
|
public enum DateFormatHandling
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Dates are written in the ISO 8061 format, e.g. "2012-03-21T05:40Z".
|
||||||
|
/// </summary>
|
||||||
IsoDateFormat,
|
IsoDateFormat,
|
||||||
|
/// <summary>
|
||||||
|
/// Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/".
|
||||||
|
/// </summary>
|
||||||
MicrosoftDateFormat
|
MicrosoftDateFormat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,10 +93,11 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value to convert.</param>
|
/// <param name="value">The value to convert.</param>
|
||||||
/// <param name="format">The format the date will be converted to.</param>
|
/// <param name="format">The format the date will be converted to.</param>
|
||||||
|
/// <param name="timeZoneHandling">The time zone handling when the date is converted to a string.</param>
|
||||||
/// <returns>A JSON string representation of the <see cref="DateTime"/>.</returns>
|
/// <returns>A JSON string representation of the <see cref="DateTime"/>.</returns>
|
||||||
public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneOption)
|
public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling)
|
||||||
{
|
{
|
||||||
DateTime updatedDateTime = EnsureDateTime(value, timeZoneOption);
|
DateTime updatedDateTime = EnsureDateTime(value, timeZoneHandling);
|
||||||
|
|
||||||
using (StringWriter writer = StringUtils.CreateStringWriter(64))
|
using (StringWriter writer = StringUtils.CreateStringWriter(64))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ namespace Newtonsoft.Json
|
|||||||
protected internal set { _quoteChar = value; }
|
protected internal set { _quoteChar = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set how <see cref="DateTime"/> time zones are handling when reading JSON.
|
||||||
|
/// </summary>
|
||||||
public DateTimeZoneHandling DateTimeZoneHandling
|
public DateTimeZoneHandling DateTimeZoneHandling
|
||||||
{
|
{
|
||||||
get { return _dateTimeZoneHandling; }
|
get { return _dateTimeZoneHandling; }
|
||||||
|
|||||||
@@ -285,24 +285,36 @@ namespace Newtonsoft.Json
|
|||||||
set { _context = value; }
|
set { _context = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates how JSON text output is formatted.
|
||||||
|
/// </summary>
|
||||||
public virtual Formatting Formatting
|
public virtual Formatting Formatting
|
||||||
{
|
{
|
||||||
get { return _formatting ?? JsonSerializerSettings.DefaultFormatting; }
|
get { return _formatting ?? JsonSerializerSettings.DefaultFormatting; }
|
||||||
set { _formatting = value; }
|
set { _formatting = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set how dates are written to JSON text.
|
||||||
|
/// </summary>
|
||||||
public virtual DateFormatHandling DateFormatHandling
|
public virtual DateFormatHandling DateFormatHandling
|
||||||
{
|
{
|
||||||
get { return _dateFormatHandling ?? JsonSerializerSettings.DefaultDateFormatHandling; }
|
get { return _dateFormatHandling ?? JsonSerializerSettings.DefaultDateFormatHandling; }
|
||||||
set { _dateFormatHandling = value; }
|
set { _dateFormatHandling = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set how <see cref="DateTime"/> time zones are handling during serialization and deserialization.
|
||||||
|
/// </summary>
|
||||||
public virtual DateTimeZoneHandling DateTimeZoneHandling
|
public virtual DateTimeZoneHandling DateTimeZoneHandling
|
||||||
{
|
{
|
||||||
get { return _dateTimeZoneHandling ?? JsonSerializerSettings.DefaultDateTimeZoneHandling; }
|
get { return _dateTimeZoneHandling ?? JsonSerializerSettings.DefaultDateTimeZoneHandling; }
|
||||||
set { _dateTimeZoneHandling = value; }
|
set { _dateTimeZoneHandling = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the culture used when reading JSON. Defaults to <see cref="CultureInfo.InvariantCulture"/>.
|
||||||
|
/// </summary>
|
||||||
public virtual CultureInfo Culture
|
public virtual CultureInfo Culture
|
||||||
{
|
{
|
||||||
get { return _culture ?? JsonSerializerSettings.DefaultCulture; }
|
get { return _culture ?? JsonSerializerSettings.DefaultCulture; }
|
||||||
|
|||||||
@@ -127,24 +127,36 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The context.</value>
|
/// <value>The context.</value>
|
||||||
public StreamingContext Context { get; set; }
|
public StreamingContext Context { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates how JSON text output is formatted.
|
||||||
|
/// </summary>
|
||||||
public Formatting Formatting
|
public Formatting Formatting
|
||||||
{
|
{
|
||||||
get { return _formatting ?? DefaultFormatting; }
|
get { return _formatting ?? DefaultFormatting; }
|
||||||
set { _formatting = value; }
|
set { _formatting = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set how dates are written to JSON text.
|
||||||
|
/// </summary>
|
||||||
public DateFormatHandling DateFormatHandling
|
public DateFormatHandling DateFormatHandling
|
||||||
{
|
{
|
||||||
get { return _dateFormatHandling ?? DefaultDateFormatHandling; }
|
get { return _dateFormatHandling ?? DefaultDateFormatHandling; }
|
||||||
set { _dateFormatHandling = value; }
|
set { _dateFormatHandling = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set how <see cref="DateTime"/> time zones are handling during serialization and deserialization.
|
||||||
|
/// </summary>
|
||||||
public DateTimeZoneHandling DateTimeZoneHandling
|
public DateTimeZoneHandling DateTimeZoneHandling
|
||||||
{
|
{
|
||||||
get { return _dateTimeZoneHandling ?? DefaultDateTimeZoneHandling; }
|
get { return _dateTimeZoneHandling ?? DefaultDateTimeZoneHandling; }
|
||||||
set { _dateTimeZoneHandling = value; }
|
set { _dateTimeZoneHandling = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the culture used when reading JSON. Defaults to <see cref="CultureInfo.InvariantCulture"/>.
|
||||||
|
/// </summary>
|
||||||
public CultureInfo Culture
|
public CultureInfo Culture
|
||||||
{
|
{
|
||||||
get { return _culture ?? DefaultCulture; }
|
get { return _culture ?? DefaultCulture; }
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ namespace Newtonsoft.Json
|
|||||||
private DateTimeZoneHandling _dateTimeZoneHandling;
|
private DateTimeZoneHandling _dateTimeZoneHandling;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates how the output is formatted.
|
/// Indicates how JSON text output is formatted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Formatting Formatting
|
public Formatting Formatting
|
||||||
{
|
{
|
||||||
@@ -212,12 +212,18 @@ namespace Newtonsoft.Json
|
|||||||
set { _formatting = value; }
|
set { _formatting = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set how dates are written to JSON text.
|
||||||
|
/// </summary>
|
||||||
public DateFormatHandling DateFormatHandling
|
public DateFormatHandling DateFormatHandling
|
||||||
{
|
{
|
||||||
get { return _dateFormatHandling; }
|
get { return _dateFormatHandling; }
|
||||||
set { _dateFormatHandling = value; }
|
set { _dateFormatHandling = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set how <see cref="DateTime"/> time zones are handling when writing JSON.
|
||||||
|
/// </summary>
|
||||||
public DateTimeZoneHandling DateTimeZoneHandling
|
public DateTimeZoneHandling DateTimeZoneHandling
|
||||||
{
|
{
|
||||||
get { return _dateTimeZoneHandling; }
|
get { return _dateTimeZoneHandling; }
|
||||||
|
|||||||
Reference in New Issue
Block a user