MessageBuffer.Close Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Finishes working with the buffer.

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

Syntax

'Declaration
Public MustOverride Sub Close
public abstract void Close()

Remarks

You should always close a MessageBuffer instance by calling Close when finished working with it. This ensures the underlying Message (the message passed into the constructor) is also closed, which frees system resources.

If you have called CreateBufferedCopy to create a message buffer of a message and inspected the message using CreateMessage, you get a InvalidOperationException when you attempt to close the buffer using this method. To avoid this problem, you must recreate the message from the buffer before closing. See the code sample in the Example section for a demonstration of the previous scenario and a way to resolve this problem.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.