BodyWriter.WriteBodyContents(XmlDictionaryWriter) Método

Definición

Escribe el contenido del cuerpo del mensaje.

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

XmlDictionaryWriter que se usa para escribir el cuerpo del mensaje.

Excepciones

writer es null.

Ejemplos

En el ejemplo siguiente se muestra cómo llamar al 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()

Comentarios

La implementación predeterminada de WriteBodyContents(XmlDictionaryWriter) llamadas OnWriteBodyContents(XmlDictionaryWriter), por lo que reemplazar OnWriteBodyContents(XmlDictionaryWriter) proporciona el mejor punto de extensión.

Se aplica a