MessagePropertyFilter.DefaultBodySize Property

 

Gets or sets the size, in bytes, of the default body buffer.

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

[MessagingDescriptionAttribute("MsgDefaultBodySize")]
public int DefaultBodySize { get; set; }

Property Value

Type: System.Int32

The default body buffer size to create when the message is received. The default is 1024 bytes.

Exception Condition
ArgumentException

The assigned value is negative.

The default body size specifies the number of bytes to allocate for the message's body contents. The Body property of the Message class represents the serialized contents of the message. The body can contain up to 4 MB of data. Restricting the body size can improve performance.

The following code example demonstrates the use of the DefaultBodySize property.

// Set the filter's DefaultBodySize property to 2048 bytes.
queue.MessageReadPropertyFilter.DefaultBodySize = 2048;

// Display the new value of the filter's DefaultBodySize property.
Console.WriteLine("MessageReadPropertyFilter.DefaultBodySize: {0}",
    queue.MessageReadPropertyFilter.DefaultBodySize.ToString());

.NET Framework
Available since 1.1
Return to top
Show: