Share via


Rss20ItemFormatter.WriteTo(XmlWriter) Méthode

Définition

Écrit le SyndicationItem associé au Rss20FeedFormatter dans l’objet XmlWriter spécifié.

public:
 override void WriteTo(System::Xml::XmlWriter ^ writer);
public override void WriteTo (System.Xml.XmlWriter writer);
override this.WriteTo : System.Xml.XmlWriter -> unit
Public Overrides Sub WriteTo (writer As XmlWriter)

Paramètres

writer
XmlWriter

XmlWriter dans lequel écrire.

Exemples

Le code suivant illustre la création d'un flux de syndication et l'utilisation d'un module Rss20ItemFormatter pour écrire l'élément dans un objet XmlWriter.

SyndicationItem item = new SyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now);

XmlWriter rssWriter = XmlWriter.Create("RSS.xml");
Rss20ItemFormatter rssFormatter = new Rss20ItemFormatter(item);

rssFormatter.WriteTo(rssWriter);
rssWriter.Close();

S’applique à