SerializeElement() protected method

protected SerializeElement ( XmlWriter writer, bool serializeCollectionKey ) : bool
writer System.Xml.XmlWriter
serializeCollectionKey bool
return bool
        protected internal override bool SerializeElement(XmlWriter writer, bool serializeCollectionKey)
        {
            if (serializeCollectionKey)
            {
                return(base.SerializeElement(writer, serializeCollectionKey));
            }

            bool wroteData = false;

            if (IsBasic)
            {
                for (int n = 0; n < list.Count; n++)
                {
                    ConfigurationElement elem = (ConfigurationElement)list [n];
                    if (ElementName != string.Empty)
                    {
                        wroteData = elem.SerializeToXmlElement(writer, ElementName) || wroteData;
                    }
                    else
                    {
                        wroteData = elem.SerializeElement(writer, false) || wroteData;
                    }
                }
            }
            else
            {
                if (emitClear)
                {
                    writer.WriteElementString(clearElementName, "");
                    wroteData = true;
                }

                if (removed != null)
                {
                    for (int n = 0; n < removed.Count; n++)
                    {
                        writer.WriteStartElement(removeElementName);
                        ((ConfigurationElement)removed[n]).SerializeElement(writer, true);
                        writer.WriteEndElement();
                    }
                    wroteData = wroteData || removed.Count > 0;
                }

                for (int n = 0; n < list.Count; n++)
                {
                    ConfigurationElement elem = (ConfigurationElement)list [n];
                    elem.SerializeToXmlElement(writer, addElementName);
                }

                wroteData = wroteData || list.Count > 0;
            }
            return(wroteData);
        }