Esempio n. 1
0
 public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
 {
     if (!(value is SpecialInt val))
     {
         val = new SpecialInt(100);
     }
     writer.WriteValue(val.Value);
 }
Esempio n. 2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            SpecialInt val = (SpecialInt)(long)reader.Value;

            if (val == null)
            {
                val = new SpecialInt(100);
            }
            return(val);
        }