BodyWriter.OnWriteBodyContents Method (XmlDictionaryWriter)

 

When implemented, provides an extensibility point when the body contents are written.

Namespace:   System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

protected abstract void OnWriteBodyContents(
	XmlDictionaryWriter writer
)

Parameters

writer
Type: System.Xml.XmlDictionaryWriter

The XmlDictionaryWriter used to write out the message body.

This method must be implemented by classes derived from BodyWriter. This is the key method that writes the body. If the BodyWriter is buffered then this method is called only once.

The following example illustrates an override of the OnWriteBodyContents(XmlDictionaryWriter) method.

protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
   writer.WriteStartElement(textTag);

   foreach (string str in bodySegment)
   {
       writer.WriteString(str);
   }

    writer.WriteEndElement();
}

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: