Export (0) Print
Expand All

MessagePropertyFilter.Body Property

Gets or sets a value that indicates whether to retrieve Message.Body property information when receiving or peeking a message.

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

[MessagingDescriptionAttribute("MsgBody")]
public bool Body { get; set; }

Property Value

Type: System.Boolean
true to receive Message.Body information; otherwise, false. The default is true.

The Body property of the Message class represents the serialized contents of the message. The body can contain up to 4 MB of data.

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);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft