共用方式為


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();

適用於