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

            if (objectSerializer is CollectionSerializer collectionSerializer)
            {
                return(new CollectionObjectSerializer(collectionSerializer));
            }
            return(objectSerializer);
        }
예제 #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);
        }
예제 #3
0
        public ComplexPropertySerializer(PropertyInfo propertyInfo) : base(propertyInfo)
        {
            this.MemberAccessor = MemberAccessorFactory.Create(this.PropertyInfo);

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