Body Property

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)

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
Available since 1.1
Return to top
© 2015 Microsoft