Represents a memory buffer that stores an entire message for future consumption.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The body of a Message instance can only be consumed or written once. If you wish to consume a Message instance more than once, you should use the class to completely store an entire Message instance into memory.
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 instance by calling Close when finished working with it. This allows system resources to potentially be freed sooner.
Special note for Managed C++ users deriving from this class:
Put your cleanup code in (On)(Begin)Close (and/or OnAbort), not in a destructor.
Avoid destructors: they cause the compiler to auto-generate IDisposable
Avoid non-reference members: they can cause the compiler to auto-generate IDisposable
Avoid finalizers; but if you include one, you should suppress the build warning and call SuppressFinalize(Object) and the finalizer itself from (On)(Begin)Close (and/or OnAbort) in order to emulate what would have been the auto-generated IDisposable behavior.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.