Partilhar via


BodyWriter.WriteBodyContents(XmlDictionaryWriter) Método

Definição

Grava o conteúdo do corpo da mensagem.

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)

Parâmetros

writer
XmlDictionaryWriter

O XmlDictionaryWriter usado para gravar o corpo da mensagem.

Exceções

writer é null.

Exemplos

O exemplo a seguir mostra como chamar o WriteBodyContents(XmlDictionaryWriter) método .

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

Comentários

A implementação padrão de WriteBodyContents(XmlDictionaryWriter) chamadas OnWriteBodyContents(XmlDictionaryWriter), portanto, OnWriteBodyContents(XmlDictionaryWriter) substituir fornece o melhor ponto de extensão.

Aplica-se a