-Added ReadAsInt32 to JsonReader

-Improved performance by using an enum rather than a type check to test contract type
This commit is contained in:
JamesNK
2012-01-22 01:51:01 +00:00
parent cd424a7bc5
commit 58d51cda5c
24 changed files with 398 additions and 238 deletions
-26
View File
@@ -529,32 +529,6 @@ namespace Newtonsoft.Json
return IsJsonPrimitiveTypeCode(Type.GetTypeCode(type));
}
internal static bool IsJsonPrimitive(object value)
{
if (value == null)
return true;
IConvertible convertible = value as IConvertible;
if (convertible != null)
return IsJsonPrimitiveTypeCode(convertible.GetTypeCode());
#if !PocketPC && !NET20
if (value is DateTimeOffset)
return true;
#endif
if (value is byte[])
return true;
if (value is Uri)
return true;
if (value is TimeSpan)
return true;
if (value is Guid)
return true;
return false;
}
/// <summary>
/// Serializes the specified object to a JSON string.
/// </summary>