public XmlSerializer CreateSerializer(Type type,
                                              XmlAttributeOverrides overrides,
                                              Type[] extraTypes,
                                              XmlRootAttribute root,
                                              string defaultNamespace)
        {
            XmlTypeSerializationSource source = new XmlTypeSerializationSource(type, root, overrides, defaultNamespace, extraTypes);

            lock (serializersBySource)
            {
                XmlSerializer ser = (XmlSerializer)serializersBySource [source];
                if (ser == null)
                {
                    ser = new XmlSerializer(type, overrides, extraTypes, root, defaultNamespace);
                    serializersBySource [ser.Mapping.Source] = ser;
                }
                return(ser);
            }
        }
예제 #2
0
        public override bool Equals(object o)
        {
            XmlTypeSerializationSource other = o as XmlTypeSerializationSource;

            if (other == null)
            {
                return(false);
            }

            if (!type.Equals(other.type))
            {
                return(false);
            }
            if (rootHash != other.rootHash)
            {
                return(false);
            }
            if (attributeOverridesHash != other.attributeOverridesHash)
            {
                return(false);
            }

            return(base.BaseEquals(other));
        }