Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UdtWrapper"/> class.
        /// </summary>
        /// <param name="udtType">The underlying type to create the wrapper around.</param>
        /// <param name="callerSerializer">reference to the serializer
        /// instance which is building this instance.</param>
        public UdtWrapper(Type udtType, YAXSerializer callerSerializer)
        {
            this.m_isTypeDictionary = false;
            this.m_udtType          = udtType;
            this.m_isTypeCollection = ReflectionUtils.IsCollectionType(this.m_udtType);
            this.m_isTypeDictionary = ReflectionUtils.IsIDictionary(this.m_udtType);

            this.Alias                       = StringUtils.RefineSingleElement(ReflectionUtils.GetTypeFriendlyName(this.m_udtType));
            this.Comment                     = null;
            this.FieldsToSerialize           = YAXSerializationFields.PublicPropertiesOnly;
            this.IsAttributedAsNotCollection = false;

            this.SetYAXSerializerOptions(callerSerializer);

            foreach (var attr in this.m_udtType.GetCustomAttributes(true))
            {
                if (attr is YAXBaseAttribute)
                {
                    this.ProcessYAXAttribute(attr);
                }
            }
        }