/// <summary> /// Saves the current <see cref="YahooMediaHash"/> 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 //------------------------------------------------------------ YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension(); //------------------------------------------------------------ // Write XML representation of the current instance //------------------------------------------------------------ writer.WriteStartElement("hash", extension.XmlNamespace); if (this.Algorithm != YahooMediaHashAlgorithm.None) { writer.WriteAttributeString("algo", YahooMediaHash.HashAlgorithmAsString(this.Algorithm)); } if (!String.IsNullOrEmpty(this.Value)) { writer.WriteString(this.Value); } writer.WriteEndElement(); }
/// <summary> /// Saves the current <see cref="YahooMediaHash"/> 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"); YahooMediaSyndicationExtension extension = new YahooMediaSyndicationExtension(); writer.WriteStartElement("hash", extension.XmlNamespace); if (this.Algorithm != YahooMediaHashAlgorithm.None) { writer.WriteAttributeString("algo", YahooMediaHash.HashAlgorithmAsString(this.Algorithm)); } if (!String.IsNullOrEmpty(this.Value)) { writer.WriteString(this.Value); } writer.WriteEndElement(); }