Ejemplo n.º 1
0
        protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
        {
            Debug.Assert(context != null);
            Debug.Assert(reader != null);

            return(BooleanObject.Box(reader.ReadBoolean()));
        }
 protected override object ImportFromNumber(ImportContext context, JsonReader reader)
 {
     Debug.Assert(context != null);
     Debug.Assert(reader != null);
     try
     {
         return(BooleanObject.Box(reader.ReadNumber().ToInt64() != 0));
     }
     catch (FormatException innerException)
     {
         throw new JsonException($"The JSON Number {reader.Text} must be an integer to be convertible to System.Boolean.", innerException);
     }
 }
Ejemplo n.º 3
0
 protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
 {
     return BooleanObject.Box(reader.ReadBoolean());
 }
Ejemplo n.º 4
0
 protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
 {
     return(Convert.ChangeType(BooleanObject.Box(reader.ReadBoolean()), OutputType));
 }