Gets or sets the information in the body of the message.
Assembly: System.Messaging (in System.Messaging.dll)
The body of a message can consist of any type of information—for example, a string, a date, a currency, a number, an array of bytes, or any managed object. This information is serialized into a Stream to be passed to the queue.
Specify either the Body property or the property before sending the Message object. If you set the Body property, the contents are serialized into the property. However, you can choose to write the property directly. This is useful, for example, when you want to open a connection to a file and stream its contents as the body of your message.
Unless you write the contents of the message directly to the property, set the Formatter property before you send the message. When the Send method is called on the MessageQueue instance, the body is serialized using the formatter contained in the Formatter property. If you send the message without specifying a value for the Formatter property, the formatter defaults to XmlMessageFormatter.
If you set the UseEncryption property to true for the body of this message, the message will be encrypted when it is sent, not when you set the Body property. Therefore, the property is never encrypted.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.