-Xml documentation

This commit is contained in:
James Newton-King
2012-03-05 19:30:14 +13:00
parent fd760e3389
commit f8a13d7aa3
6 changed files with 46 additions and 3 deletions
@@ -1,8 +1,17 @@
namespace Newtonsoft.Json
{
/// <summary>
/// Specifies how dates are formatted when writing JSON text.
/// </summary>
public enum DateFormatHandling
{
/// <summary>
/// Dates are written in the ISO 8061 format, e.g. "2012-03-21T05:40Z".
/// </summary>
IsoDateFormat,
/// <summary>
/// Dates are written in the Microsoft JSON format, e.g. "\/Date(1198908717056)\/".
/// </summary>
MicrosoftDateFormat
}
}
+3 -2
View File
@@ -93,10 +93,11 @@ namespace Newtonsoft.Json
/// </summary>
/// <param name="value">The value to convert.</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>
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))
{
+3
View File
@@ -137,6 +137,9 @@ namespace Newtonsoft.Json
protected internal set { _quoteChar = value; }
}
/// <summary>
/// Get or set how <see cref="DateTime"/> time zones are handling when reading JSON.
/// </summary>
public DateTimeZoneHandling DateTimeZoneHandling
{
get { return _dateTimeZoneHandling; }
+12
View File
@@ -285,24 +285,36 @@ namespace Newtonsoft.Json
set { _context = value; }
}
/// <summary>
/// Indicates how JSON text output is formatted.
/// </summary>
public virtual Formatting Formatting
{
get { return _formatting ?? JsonSerializerSettings.DefaultFormatting; }
set { _formatting = value; }
}
/// <summary>
/// Get or set how dates are written to JSON text.
/// </summary>
public virtual DateFormatHandling DateFormatHandling
{
get { return _dateFormatHandling ?? JsonSerializerSettings.DefaultDateFormatHandling; }
set { _dateFormatHandling = value; }
}
/// <summary>
/// Get or set how <see cref="DateTime"/> time zones are handling during serialization and deserialization.
/// </summary>
public virtual DateTimeZoneHandling DateTimeZoneHandling
{
get { return _dateTimeZoneHandling ?? JsonSerializerSettings.DefaultDateTimeZoneHandling; }
set { _dateTimeZoneHandling = value; }
}
/// <summary>
/// Gets or sets the culture used when reading JSON. Defaults to <see cref="CultureInfo.InvariantCulture"/>.
/// </summary>
public virtual CultureInfo Culture
{
get { return _culture ?? JsonSerializerSettings.DefaultCulture; }
@@ -127,24 +127,36 @@ namespace Newtonsoft.Json
/// <value>The context.</value>
public StreamingContext Context { get; set; }
/// <summary>
/// Indicates how JSON text output is formatted.
/// </summary>
public Formatting Formatting
{
get { return _formatting ?? DefaultFormatting; }
set { _formatting = value; }
}
/// <summary>
/// Get or set how dates are written to JSON text.
/// </summary>
public DateFormatHandling DateFormatHandling
{
get { return _dateFormatHandling ?? DefaultDateFormatHandling; }
set { _dateFormatHandling = value; }
}
/// <summary>
/// Get or set how <see cref="DateTime"/> time zones are handling during serialization and deserialization.
/// </summary>
public DateTimeZoneHandling DateTimeZoneHandling
{
get { return _dateTimeZoneHandling ?? DefaultDateTimeZoneHandling; }
set { _dateTimeZoneHandling = value; }
}
/// <summary>
/// Gets or sets the culture used when reading JSON. Defaults to <see cref="CultureInfo.InvariantCulture"/>.
/// </summary>
public CultureInfo Culture
{
get { return _culture ?? DefaultCulture; }
+7 -1
View File
@@ -204,7 +204,7 @@ namespace Newtonsoft.Json
private DateTimeZoneHandling _dateTimeZoneHandling;
/// <summary>
/// Indicates how the output is formatted.
/// Indicates how JSON text output is formatted.
/// </summary>
public Formatting Formatting
{
@@ -212,12 +212,18 @@ namespace Newtonsoft.Json
set { _formatting = value; }
}
/// <summary>
/// Get or set how dates are written to JSON text.
/// </summary>
public DateFormatHandling DateFormatHandling
{
get { return _dateFormatHandling; }
set { _dateFormatHandling = value; }
}
/// <summary>
/// Get or set how <see cref="DateTime"/> time zones are handling when writing JSON.
/// </summary>
public DateTimeZoneHandling DateTimeZoneHandling
{
get { return _dateTimeZoneHandling; }