public void AddBaseValueEmbedded(object o, System.Type basetype)
        {
            IXmlSerializationSurrogate ss = m_SurrogateSelector.GetSurrogate(basetype);

            if (null == ss)
            {
                throw new ArgumentException(string.Format("Type {0} has no XmlSerializationSurrogate to get serialized", basetype));
            }
            else
            {
                ss.Serialize(o, this);
            }
        }
        public void AddBaseValueEmbedded(object o, System.Type basetype)
        {
            IXmlSerializationSurrogate ss = m_SurrogateSelector.GetSurrogate(basetype);

            if (null == ss)
            {
                throw new ArgumentException(string.Format("Type {0} has no XmlSerializationSurrogate to get serialized", basetype));
            }
            else
            {
                m_Writer.WriteElementString("BaseType", m_SurrogateSelector.GetFullyQualifiedTypeName(basetype));
                ss.Serialize(o, this);
            }
        }
        public void AddBaseValueStandalone(string name, object o, System.Type basetype)
        {
            IXmlSerializationSurrogate ss = m_SurrogateSelector.GetSurrogate(basetype);

            if (null == ss)
            {
                throw new ArgumentException(string.Format("Type {0} has no XmlSerializationSurrogate to get serialized", basetype));
            }
            else
            {
                m_Writer.WriteStartElement(name);
                m_Writer.WriteAttributeString("Type", m_SurrogateSelector.GetFullyQualifiedTypeName(basetype));
                ss.Serialize(o, this);
                m_Writer.WriteEndElement();
            }
        }
        public void AddValue(string name, object o)
        {
            IXmlSerializationSurrogate ss = m_SurrogateSelector.GetSurrogate(o.GetType());

            if (null == ss)
            {
                throw new ArgumentException(string.Format("Type {0} has no XmlSerializationSurrogate to get serialized", o.GetType()));
            }
            else
            {
                PushNodeStack();
                m_CurrentNode = m_Doc.CreateElement(name);
                XmlAttribute typeattr = m_Doc.CreateAttribute("Type");
                typeattr.InnerText = m_SurrogateSelector.GetFullyQualifiedTypeName(o.GetType());
                m_CurrentNode.Attributes.Append(typeattr);

                ss.Serialize(o, this);
                FinishCurrentNode();
            }
        }
 public void AddValue(string name, object o)
 {
     if (null != o)
     {
         IXmlSerializationSurrogate ss = m_SurrogateSelector.GetSurrogate(o.GetType());
         if (null == ss)
         {
             throw new ArgumentException(string.Format("Type {0} has no XmlSerializationSurrogate to get serialized", o.GetType()));
         }
         else
         {
             m_Writer.WriteStartElement(name);
             m_Writer.WriteAttributeString("Type", m_SurrogateSelector.GetFullyQualifiedTypeName(o.GetType()));
             ss.Serialize(o, this);
             m_Writer.WriteEndElement();
         }
     }
     else // o is null, we add only an empty element
     {
         m_Writer.WriteStartElement(name);
         m_Writer.WriteAttributeString("Type", "UndefinedValue");
         m_Writer.WriteEndElement();
     }
 }