-Fixed serializing and deserializing flag enums with EnumMember attribute

-Fixed using a type converter on interfaces
-Fixed deserializing ISerializable objects that also implement IConvertible
-Fixed build
This commit is contained in:
James Newton-King
2013-05-24 19:16:02 +12:00
parent f68794d206
commit 1b63698c02
9 changed files with 592 additions and 63 deletions
-18
View File
@@ -490,24 +490,6 @@ namespace Newtonsoft.Json
throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType()));
}
internal static bool IsJsonPrimitiveType(Type t)
{
PrimitiveTypeCode typeCode = ConvertUtils.GetTypeCode(t);
if (typeCode != PrimitiveTypeCode.Empty && typeCode != PrimitiveTypeCode.Object)
return true;
#if !(PORTABLE || NETFX_CORE)
if (typeof(IConvertible).IsAssignableFrom(t)
|| (ReflectionUtils.IsNullableType(t) && typeof(IConvertible).IsAssignableFrom(Nullable.GetUnderlyingType(t))))
{
return !typeof(JToken).IsAssignableFrom(t);
}
#endif
return false;
}
#region Serialize
/// <summary>
/// Serializes the specified object to a JSON string.