コード例 #1
0
        protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
        {
            Debug.Assert(context != null);
            Debug.Assert(reader != null);

            return(BooleanObject.Box(reader.ReadBoolean()));
        }
コード例 #2
0
        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 e)
            {
                throw new JsonException(string.Format("The JSON Number {0} must be an integer to be convertible to System.Boolean.", reader.Text), e);
            }
        }
コード例 #3
0
 protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
 {
     return(BooleanObject.Box(reader.ReadBoolean()));
 }
コード例 #4
0
 protected override object ImportFromBoolean(ImportContext context, JsonReader reader)
 {
     return(Convert.ChangeType(BooleanObject.Box(reader.ReadBoolean()), OutputType));
 }