Atom10ItemFormatter.WriteTo(XmlWriter) 方法

定義

將與 Atom10ItemFormatter 相關聯的 SyndicationItem 寫入指定的 XmlWriterWrites the SyndicationItem associated with the Atom10ItemFormatter to the specified 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

要寫入的目標 XmlWriterThe XmlWriter to write to.

範例

下列程式碼會示範如何呼叫 WriteToThe following code shows how to call the WriteTo.

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

Atom10ItemFormatter atomItemFormatter = new Atom10ItemFormatter(item);
XmlWriter atomWriter = XmlWriter.Create("Atom.xml");
atomItemFormatter.WriteTo(atomWriter);
atomWriter.Close();
Dim item As New SyndicationItem("Test Item", "This is the content for Test Item", New Uri("http://localhost/ItemOne"), "TestItemID", DateTime.Now)

Dim atomItemFormatter As New Atom10ItemFormatter(item)
Dim atomWriter As XmlWriter = XmlWriter.Create("Atom.xml")
atomItemFormatter.WriteTo(atomWriter)
atomWriter.Close()

適用於