Export (0) Print
Expand All

MessageBuffer Class

Represents a memory buffer that stores an entire message for future consumption.

System.Object
  System.ServiceModel.Channels.MessageBuffer

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

'Declaration
Public MustInherit Class MessageBuffer _
	Implements IDisposable

The MessageBuffer type exposes the following members.

  NameDescription
Protected methodSupported by Silverlight for Windows PhoneMessageBufferInitializes a new instance of the MessageBuffer class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneBufferSizeGets the approximate number of bytes accessed by this MessageBuffer.
Public propertySupported by Silverlight for Windows PhoneMessageContentTypeGets the type of message content stored in this buffer.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneCloseFinishes working with the buffer.
Public methodSupported by Silverlight for Windows PhoneCreateMessageReturns a copy of the original message.
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneWriteMessageWrites the entire content of this buffer to the specified I/O stream.
Top

  NameDescription
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneIDisposable.DisposeReleases the unmanaged resources used by the MessageBuffer and optionally releases the managed resources. This method cannot be inherited.
Top

The body of a Message instance can only be accessed or written once. If you wish to access a Message instance more than once, you should use the MessageBuffer class to completely store an entire Message instance into memory.

A MessageBuffer instance is constructed by calling CreateBufferedCopy of a Message instance. A new MessageBuffer is then created and returned, which assumes ownership of the Message and reads the entire content into memory.

To retrieve a copy of a Message from the MessageBuffer, you must call the CreateMessage method of the MessageBuffer. This returns an identical copy of the original Message instance you provided.

You can control the maximum size of the buffer by setting BufferSize to the maximum number of bytes desired. This number does not necessarily cover any transient allocations related to building the buffer or properties attached to the message.

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) instance is also closed, which frees system resources.

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

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft