Export (0) Print
Expand All

Message.BodyStream Property

Gets or sets the information in the body of the message.

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

public Stream BodyStream { get; set; }
/** @property */
public Stream get_BodyStream ()

/** @property */
public void set_BodyStream (Stream value)

public function get BodyStream () : Stream

public function set BodyStream (value : Stream)

Not applicable.

Property Value

A Stream that contains the serialized information included in the Body of the message.

Exception typeCondition

InvalidOperationException

The message queue is filtered to ignore the Body property.

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 BodyStream property before sending the Message object. If you set the Body property, the contents are serialized into the BodyStream property. However, you can choose to write the BodyStream 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 BodyStream 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 BodyStream property is never encrypted.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft