-Maded explicit JValue conversions more flexible converting values

-Added implicit conversions for Uri, TimeSpan, Guid
-Fixed JValue constructors for Uri, TimeSpan, Guid assigning incorrect JTokenType
This commit is contained in:
James Newton-King
2012-11-20 00:44:04 +13:00
parent a6b94d2a13
commit 9160416fc3
6 changed files with 232 additions and 76 deletions
+3 -3
View File
@@ -135,7 +135,7 @@ namespace Newtonsoft.Json.Linq
/// </summary>
/// <param name="value">The value.</param>
public JValue(Guid value)
: this(value, JTokenType.String)
: this(value, JTokenType.Guid)
{
}
@@ -144,7 +144,7 @@ namespace Newtonsoft.Json.Linq
/// </summary>
/// <param name="value">The value.</param>
public JValue(Uri value)
: this(value, JTokenType.String)
: this(value, JTokenType.Uri)
{
}
@@ -153,7 +153,7 @@ namespace Newtonsoft.Json.Linq
/// </summary>
/// <param name="value">The value.</param>
public JValue(TimeSpan value)
: this(value, JTokenType.String)
: this(value, JTokenType.TimeSpan)
{
}