Udostępnij za pośrednictwem


BodyWriter.WriteBodyContents(XmlDictionaryWriter) Metoda

Definicja

Zapisuje zawartość treści wiadomości.

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

Służy XmlDictionaryWriter do zapisywania treści komunikatu.

Wyjątki

writer to null.

Przykłady

W poniższym przykładzie pokazano, jak wywołać metodę 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()

Uwagi

Domyślna implementacja wywołań WriteBodyContents(XmlDictionaryWriter)OnWriteBodyContents(XmlDictionaryWriter), dlatego zastąpienie OnWriteBodyContents(XmlDictionaryWriter) zapewnia najlepszy punkt rozszerzenia.

Dotyczy