-Added ITraceWriter

-Fixed .NET 2.0 build using DateTimeOffset
This commit is contained in:
James Newton-King
2012-11-09 17:10:32 +13:00
parent 12b60f2fca
commit 89883dc57b
36 changed files with 870 additions and 117 deletions
+11 -2
View File
@@ -332,7 +332,7 @@ namespace Newtonsoft.Json.Utilities
if (targetType == typeof (Uri))
return new Uri((string) initialValue, UriKind.RelativeOrAbsolute);
if (targetType == typeof (TimeSpan))
#if !(NET35 || NET20 || SILVERLIGHT || PORTABLE)
#if !(NET35 || NET20 || PORTABLE)
return TimeSpan.Parse((string) initialValue, CultureInfo.InvariantCulture);
#else
return TimeSpan.Parse((string)initialValue);
@@ -395,7 +395,16 @@ namespace Newtonsoft.Json.Utilities
/// </returns>
public static bool TryConvert(object initialValue, CultureInfo culture, Type targetType, out object convertedValue)
{
return MiscellaneousUtils.TryAction<object>(delegate { return Convert(initialValue, culture, targetType); }, out convertedValue);
try
{
convertedValue = Convert(initialValue, culture, targetType);
return true;
}
catch
{
convertedValue = null;
return false;
}
}
#endregion