Example #1
0
 private static Value GetValue(ref JsonReader jsonReader)
 {
     var value = new Value {Type = (Value.ValueType) jsonReader.GetValueType()};
     var obj = jsonReader.ReadValue();
     switch (value.Type)
     {
         case Value.ValueType.String:
             value.StringValue = (string) new Utf8String(obj.ToString());
             break;
         case Value.ValueType.Number:
             value.NumberValue = (double) obj;
             break;
         case Value.ValueType.True:
             break;
         case Value.ValueType.False:
             break;
         case Value.ValueType.Null:
             break;
         case Value.ValueType.Object:
             value.ObjectValue = ReadObject(ref jsonReader);
             break;
         case Value.ValueType.Array:
             value.ArrayValue = ReadArray(ref jsonReader);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
     return value;
 }