public override string ToString()
        {
#if NET20
            return(ObjectExtensionMethods.XmlSerialize(this).CreateNavigator().OuterXml);
#else
            return(this.XmlSerialize().CreateNavigator().OuterXml);
#endif
        }
        public virtual void WriteXml(XmlWriter writer)
        {
            if (null == writer)
            {
                throw new ArgumentNullException("writer");
            }

            foreach (var item in this)
            {
#if NET20
                writer.WriteRaw(ObjectExtensionMethods.XmlSerialize(item).CreateNavigator().OuterXml);
#else
                writer.WriteRaw(item.XmlSerialize().CreateNavigator().OuterXml);
#endif
            }
        }
Esempio n. 3
0
        public virtual void WriteXml(XmlWriter writer)
        {
            if (null == writer)
            {
                throw new ArgumentNullException("writer");
            }

            foreach (var item in Items)
            {
                writer.WriteStartElement("command");
                writer.WriteAttributeString("type", item.GetType().AssemblyQualifiedName);
#if NET20
                writer.WriteRaw(ObjectExtensionMethods.XmlSerialize(item).CreateNavigator().OuterXml);
#else
                writer.WriteRaw(item.XmlSerialize().CreateNavigator().OuterXml);
#endif
                writer.WriteEndElement();
            }
        }