Teilen über


BodyWriter.WriteBodyContents(XmlDictionaryWriter) Methode

Definition

Schreibt den Inhalt des Nachrichtentexts.

public:
 void WriteBodyContents(System::Xml::XmlDictionaryWriter ^ writer);
public void WriteBodyContents (System.Xml.XmlDictionaryWriter writer);
member this.WriteBodyContents : System.Xml.XmlDictionaryWriter -> unit
Public Sub WriteBodyContents (writer As XmlDictionaryWriter)

Parameter

writer
XmlDictionaryWriter

Der XmlDictionaryWriter, mit dem der Nachrichtentext geschrieben wird.

Ausnahmen

writer ist null.

Beispiele

Im folgenden Beispiel wird das Aufrufen der WriteBodyContents(XmlDictionaryWriter)-Methode veranschaulicht.

string[] strings = {"Hello", "world"};
MyBodyWriter bw = new MyBodyWriter(strings);

StringBuilder strBuilder = new StringBuilder(10);
XmlWriter writer = XmlWriter.Create(strBuilder);
XmlDictionaryWriter dictionaryWriter = XmlDictionaryWriter.CreateDictionaryWriter(writer);

bw.WriteBodyContents(dictionaryWriter);
dictionaryWriter.Flush();
Dim strings() As String = {"Hello", "world"}
Dim bw As New MyBodyWriter(strings)

Dim strBuilder As New StringBuilder(10)
Dim writer = XmlWriter.Create(strBuilder)
Dim dictionaryWriter = XmlDictionaryWriter.CreateDictionaryWriter(writer)

bw.WriteBodyContents(dictionaryWriter)
dictionaryWriter.Flush()

Hinweise

Die Standardimplementierung von WriteBodyContents(XmlDictionaryWriter) ruft OnWriteBodyContents(XmlDictionaryWriter) auf, sodass das Überschreiben von OnWriteBodyContents(XmlDictionaryWriter) den besten Erweiterungspunkt bereitstellt.

Gilt für: