Rss20ItemFormatter.WriteTo(XmlWriter) 方法

定义

将与 Rss20FeedFormatter 关联的 SyndicationItem 写入指定的 XmlWriter

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)

参数

writer
XmlWriter

要向其中进行写入的 XmlWriter

示例

下面的代码演示如何创建联合项以及如何使用 Rss20ItemFormatter 将项写入 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();

适用于