Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Newtonsoft.Json/Serialization/JsonContract.cs')
-rw-r--r--Src/Newtonsoft.Json/Serialization/JsonContract.cs51
1 files changed, 37 insertions, 14 deletions
diff --git a/Src/Newtonsoft.Json/Serialization/JsonContract.cs b/Src/Newtonsoft.Json/Serialization/JsonContract.cs
index f8b1a4e..ef450b6 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonContract.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonContract.cs
@@ -30,20 +30,44 @@ using Newtonsoft.Json.Utilities;
namespace Newtonsoft.Json.Serialization
{
+ internal enum JsonContractType
+ {
+ None,
+ Object,
+ Array,
+ Primitive,
+ String,
+ Dictionary,
+#if !(NET35 || NET20 || WINDOWS_PHONE)
+ Dynamic,
+#endif
+#if !SILVERLIGHT && !PocketPC
+ Serializable,
+#endif
+ Linq
+ }
+
+ internal enum ReadType
+ {
+ Read,
+ ReadAsInt32,
+ ReadAsDecimal,
+ ReadAsBytes,
+#if !NET20
+ ReadAsDateTimeOffset
+#endif
+ }
+
/// <summary>
/// Contract details for a <see cref="Type"/> used by the <see cref="JsonSerializer"/>.
/// </summary>
public abstract class JsonContract
{
- internal enum ReadType
- {
- Read,
- ReadAsDecimal,
- ReadAsBytes,
-#if !NET20
- ReadAsDateTimeOffset
-#endif
- }
+ internal bool IsNullable;
+ internal bool IsConvertable;
+ internal Type NonNullableUnderlyingType;
+ internal ReadType InternalReadType;
+ internal JsonContractType ContractType;
/// <summary>
/// Gets the underlying type for the contract.
@@ -73,11 +97,6 @@ namespace Newtonsoft.Json.Serialization
// checked for after passed in converters and attribute specified converters
internal JsonConverter InternalConverter { get; set; }
- internal ReadType InternalReadType;
- internal bool IsNullable;
- internal bool IsConvertable;
- internal Type NonNullableUnderlyingType;
-
#if !PocketPC
/// <summary>
/// Gets or sets the method called immediately after deserialization of the object.
@@ -177,6 +196,10 @@ namespace Newtonsoft.Json.Serialization
{
InternalReadType = ReadType.ReadAsBytes;
}
+ else if (NonNullableUnderlyingType == typeof(int))
+ {
+ InternalReadType = ReadType.ReadAsInt32;
+ }
else if (NonNullableUnderlyingType == typeof(decimal))
{
InternalReadType = ReadType.ReadAsDecimal;