Partager via


BodyWriter.WriteBodyContents(XmlDictionaryWriter) Méthode

Définition

Écrit le contenu du corps du message.

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)

Paramètres

writer
XmlDictionaryWriter

La XmlDictionaryWriter utilisée pour écrire le corps du message.

Exceptions

writer a la valeur null.

Exemples

L'exemple suivant montre comment appeler la méthode 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()

Remarques

L'implémentation par défaut de WriteBodyContents(XmlDictionaryWriter) appelle OnWriteBodyContents(XmlDictionaryWriter), par conséquent, la substitution de OnWriteBodyContents(XmlDictionaryWriter) fournit le meilleur point d'extension.

S’applique à