Beispiel #1
0
        private object DeserializeInternal(int depth)
        {
            if (++depth > this._depthLimit)
            {
                throw new ArgumentException(this._s.GetDebugString(JSON_DepthLimitExceeded));
            }
            char?nextNonEmptyChar = this._s.GetNextNonEmptyChar();
            char?nullable2        = nextNonEmptyChar;
            int? nullable4        = nullable2.HasValue ? new int?(nullable2.GetValueOrDefault()) : null;

            if (!nullable4.HasValue)
            {
                return(null);
            }
            this._s.MovePrev();
            if (this.IsNextElementDateTime())
            {
                return(this.DeserializeStringIntoDateTime());
            }
            if (IsNextElementObject(nextNonEmptyChar))
            {
                IDictionary <string, object> o = this.DeserializeDictionary(depth);
                if (o.ContainsKey("__type"))
                {
                    return(ObjectConverter.ConvertObjectToType(o, null, this._serializer));
                }
                return(o);
            }
            if (IsNextElementArray(nextNonEmptyChar))
            {
                return(this.DeserializeList(depth));
            }
            if (IsNextElementString(nextNonEmptyChar))
            {
                return(this.DeserializeString());
            }
            return(this.DeserializePrimitiveObject());
        }
Beispiel #2
0
 public T ConvertToType <T>(object obj)
 {
     return((T)ObjectConverter.ConvertObjectToType(obj, typeof(T), this));
 }