Share via


BodyWriter.WriteBodyContents(XmlDictionaryWriter) Metoda

Definice

Zapíše obsah textu zprávy.

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)

Parametry

writer
XmlDictionaryWriter

Slouží XmlDictionaryWriter k zápisu textu zprávy.

Výjimky

writer je null.

Příklady

Následující ukázka ukazuje, jak volat metodu WriteBodyContents(XmlDictionaryWriter) .

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

Poznámky

Výchozí implementace WriteBodyContents(XmlDictionaryWriter) volání , OnWriteBodyContents(XmlDictionaryWriter)takže přepsání OnWriteBodyContents(XmlDictionaryWriter) poskytuje nejlepší bod rozšíření.

Platí pro