MessagePropertyFilter.Body Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that indicates whether to retrieve Body property information when receiving or peeking a message.
public:
property bool Body { bool get(); void set(bool value); };
[System.Messaging.MessagingDescription("MsgBody")]
public bool Body { get; set; }
[<System.Messaging.MessagingDescription("MsgBody")>]
member this.Body : bool with get, set
Public Property Body As Boolean
Property Value
true
to receive Body information; otherwise, false
. The default is true
.
- Attributes
Examples
The following code example demonstrates the use of the Body property.
// Set the queue's MessageReadPropertyFilter property
// to enable the message's Body property.
queue->MessageReadPropertyFilter->Body = true;
// Peek at the message. Time out after ten seconds
// in case the message was not delivered.
orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0));
// Display the value of the message's Body property.
Console::WriteLine("Message.Body: {0}",
orderMessage->Body);
// Set the queue's MessageReadPropertyFilter property to enable the
// message's Body property.
queue.MessageReadPropertyFilter.Body = true;
// Peek at the message. Time out after ten seconds in case the message
// was not delivered.
orderMessage = queue.Peek(TimeSpan.FromSeconds(10.0));
// Display the value of the message's Body property.
Console.WriteLine("Message.Body: {0}", orderMessage.Body);
Remarks
The Body property of the Message class represents the serialized contents of the message. The body can contain up to 4 MB of data.