示例#1
0
        private object ReadList(Type listType, object existingContainer)
        {
            if (IsDictionary(listType))
            {
                return(ReadDictionary(listType, existingContainer));
            }

            NewDocument(_reader.ReadInt32());
            var itemType = ListHelper.GetListItemType(listType);
            var isObject = typeof(object) == itemType;
            var wrapper  = BaseWrapper.Create(listType, itemType, existingContainer);

            while (!IsDone())
            {
                var storageType = ReadType();
                ReadName();
                if (storageType == Types.Object)
                {
                    NewDocument(_reader.ReadInt32());
                }
                var specificItemType = isObject ? _typeMap[storageType] : itemType;
                var value            = DeserializeValue(specificItemType, storageType);
                wrapper.Add(value);
            }
            return(wrapper.Collection);
        }