Пример #1
0
        public static ICollection <T> ParseCollection <T>(StringSegment value, Type createType, ParseStringSegmentDelegate parseFn)
        {
            if (!value.HasValue)
            {
                return(null);
            }

            var items = DeserializeArrayWithElements <T, TSerializer> .ParseGenericArray(value, parseFn);

            return(CollectionExtensions.CreateAndPopulate(createType, items));
        }
Пример #2
0
        public static void InitAot <T>()
        {
            var hold = DeserializeBuiltin <T> .Parse;

            hold = DeserializeArray <T[], TSerializer> .Parse;
            DeserializeType <TSerializer> .ExtractType(null);

            DeserializeArrayWithElements <T, TSerializer> .ParseGenericArray(null, null);

            DeserializeCollection <TSerializer> .ParseCollection <T>(null, null, null);

            DeserializeListWithElements <T, TSerializer> .ParseGenericList(null, null, null);
        }
Пример #3
0
        public static ICollection <int> ParseIntCollection(StringSegment value, Type createType)
        {
            var items = DeserializeArrayWithElements <int, TSerializer> .ParseGenericArray(value, x => int.Parse(x.Value));

            return(CollectionExtensions.CreateAndPopulate(createType, items));
        }
Пример #4
0
        public static ICollection <string> ParseStringCollection(StringSegment value, Type createType)
        {
            var items = DeserializeArrayWithElements <string, TSerializer> .ParseGenericArray(value, Serializer.ParseString);

            return(CollectionExtensions.CreateAndPopulate(createType, items));
        }