示例#1
0
        public static object DefaultDictionaryDeserializer(ListTreeNode <T> s)
        {
            switch (s.Value.ValueType)
            {
            case ValueNodeType.Object:
            {
                var u = new Dictionary <string, object>();
                foreach (var kv in s.ObjectItems())
                {
                    //var e = default(object);
                    //kv.Value.Deserialize(ref e);
                    u.Add(kv.Key.GetString(), DefaultDictionaryDeserializer(kv.Value));
                }
                return(u);
            }

            case ValueNodeType.Null:
                return(null);

            case ValueNodeType.Boolean:
                return(s.GetBoolean());

            case ValueNodeType.Integer:
                return(s.GetInt32());

            case ValueNodeType.Number:
                return(s.GetDouble());

            case ValueNodeType.String:
                return(s.GetString());

            default:
                throw new NotImplementedException(s.Value.ValueType.ToString());
            }
        }