예제 #1
0
        public ListType List <T, ListType>(string name, ListElementReader <T> readElementWithName,
                                           Func <int, ListType> createListWithCapacity)
            where ListType : IList <T>
        {
            ListSerializerWrapper <T, ListType> sList = new ListSerializerWrapper <T, ListType>();

            sList.ElementReader           = readElementWithName;
            sList.ListFactoryFromCapacity = createListWithCapacity;
            Structure(sList, name);
            return(sList.Data);
        }
예제 #2
0
        public CollectionType Collection <T, CollectionType>(string name,
                                                             ListElementReader <T> readElementWithName,
                                                             Func <int, CollectionType> createWithCapacity,
                                                             Action <int, CollectionType, T> insertAtEnd = null)
            where CollectionType : ICollection <T>
        {
            EnumerableSerializerWrapper <T, CollectionType> sColl =
                new EnumerableSerializerWrapper <T, CollectionType>();

            sColl.ElementReader = readElementWithName;
            sColl.CollectionFactoryFromCapacity = createWithCapacity;
            sColl.InsertAtEnd = insertAtEnd;
            Structure(sColl, name);
            return(sColl.Data);
        }