BodyWriter.OnWriteBodyContents(XmlDictionaryWriter) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當實作時,提供寫入本文內容時的擴充點。
protected:
abstract void OnWriteBodyContents(System::Xml::XmlDictionaryWriter ^ writer);
protected abstract void OnWriteBodyContents (System.Xml.XmlDictionaryWriter writer);
abstract member OnWriteBodyContents : System.Xml.XmlDictionaryWriter -> unit
Protected MustOverride Sub OnWriteBodyContents (writer As XmlDictionaryWriter)
參數
- writer
- XmlDictionaryWriter
用於寫出訊息本文的 XmlDictionaryWriter。
範例
下列範例說明 OnWriteBodyContents(XmlDictionaryWriter) 方法的覆寫。
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
writer.WriteStartElement(textTag);
foreach (string str in bodySegment)
{
writer.WriteString(str);
}
writer.WriteEndElement();
}
Protected Overrides Sub OnWriteBodyContents(ByVal writer As XmlDictionaryWriter)
writer.WriteStartElement(textTag)
For Each str As String In bodySegment
writer.WriteString(str)
Next str
writer.WriteEndElement()
End Sub
備註
這個方法必須由衍生自 BodyWriter 的類別實作。 這是寫入本文的重要方法。 如果 BodyWriter 已緩衝處理,則這個方法只會呼叫一次。