MessageEncoder.WriteMessage Method (Message, Stream)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

When overridden in a derived class, writes a message to a specified stream.

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

public abstract void WriteMessage(
	Message message,
	Stream stream
)

Parameters

message
Type: System.ServiceModel.Channels.Message

The Message to write to the stream.

stream
Type: System.IO.Stream

The Stream object to which the message is written.

NETCF

This method throws a NotSupportedException on the .NET Compact Framework.

The following code shows how to implement the WriteMessage(Message, Stream) method.

public override void WriteMessage(Message message, Stream stream)
{
    XmlWriter writer = XmlWriter.Create(stream, this.writerSettings);
    message.WriteMessage(writer);
    writer.Close();
}

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: