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)

public abstract class MessageBuffer : IDisposable

The MessageBuffer type exposes the following members.

  NameDescription
Protected methodMessageBufferInitializes a new instance of the MessageBuffer class.
Top

  NameDescription
Public propertyBufferSizeGets the approximate number of bytes accessed by this MessageBuffer.
Public propertyMessageContentTypeGets the type of message content stored in this buffer.
Top

  NameDescription
Public methodCloseFinishes working with the buffer.
Public methodCreateMessageReturns a copy of the original message.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodWriteMessageWrites the entire content of this buffer to the specified I/O stream.
Top

  NameDescription
Explicit interface implemetationPrivate methodIDisposable.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.

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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

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

Show:
© 2015 Microsoft