/// <summary> /// Saves the current <see cref="SimpleListSort"/> to the specified <see cref="XmlWriter"/>. /// </summary> /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param> /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception> public void WriteTo(XmlWriter writer) { Guard.ArgumentNotNull(writer, "writer"); SimpleListSyndicationExtension extension = new SimpleListSyndicationExtension(); writer.WriteStartElement("sort", extension.XmlNamespace); if (this.Namespace != null) { writer.WriteAttributeString("ns", this.Namespace.ToString()); } if (!String.IsNullOrEmpty(this.Element)) { writer.WriteAttributeString("element", this.Element); } if (!String.IsNullOrEmpty(this.Label)) { writer.WriteAttributeString("label", this.Label); } if (this.DataType != SimpleListDataType.None) { writer.WriteAttributeString("data-type", SimpleListSort.DataTypeAsString(this.DataType)); } if (this.IsDefault) { writer.WriteAttributeString("default", "true"); } writer.WriteEndElement(); }
/// <summary> /// Saves the current <see cref="SimpleListSort"/> to the specified <see cref="XmlWriter"/>. /// </summary> /// <param name="writer">The <see cref="XmlWriter"/> to which you want to save.</param> /// <exception cref="ArgumentNullException">The <paramref name="writer"/> is a null reference (Nothing in Visual Basic).</exception> public void WriteTo(XmlWriter writer) { //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(writer, "writer"); //------------------------------------------------------------ // Create extension instance to retrieve XML namespace //------------------------------------------------------------ SimpleListSyndicationExtension extension = new SimpleListSyndicationExtension(); //------------------------------------------------------------ // Write XML representation of the current instance //------------------------------------------------------------ writer.WriteStartElement("sort", extension.XmlNamespace); if (this.Namespace != null) { writer.WriteAttributeString("ns", this.Namespace.ToString()); } if (!String.IsNullOrEmpty(this.Element)) { writer.WriteAttributeString("element", this.Element); } if (!String.IsNullOrEmpty(this.Label)) { writer.WriteAttributeString("label", this.Label); } if (this.DataType != SimpleListDataType.None) { writer.WriteAttributeString("data-type", SimpleListSort.DataTypeAsString(this.DataType)); } if (this.IsDefault) { writer.WriteAttributeString("default", "true"); } writer.WriteEndElement(); }