Exemple #1
0
        private static IObjectSerializer CreateObjectSerializer(Type targetType)
        {
            IObjectSerializer objectSerializer = ObjectSerializerFactory.Create(targetType);

            if (objectSerializer is CollectionSerializer collectionSerializer)
            {
                return(new CollectionObjectSerializer(collectionSerializer));
            }
            return(objectSerializer);
        }
Exemple #2
0
        public CollectionSerializer(Type targetType)
        {
            if (targetType == null)
            {
                throw new ArgumentNullException(nameof(targetType));
            }

            this.TargetType              = targetType;
            this.ElementType             = this.TargetType.GetCollectionElemenType();
            this.ElementObjectSerializer = ObjectSerializerFactory.Create(this.ElementType);
        }
Exemple #3
0
        public ComplexPropertySerializer(PropertyInfo propertyInfo) : base(propertyInfo)
        {
            this.MemberAccessor = MemberAccessorFactory.Create(this.PropertyInfo);

            this.ObjectSerializer = ObjectSerializerFactory.Create(this.PropertyInfo.PropertyType);
        }