MessagePropertyFilter.Body 属性

定义

获取或设置一个值,该值指示接收或查看消息时是否检索 Body 属性信息。

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

属性值

如果接收 Body 信息,则为 true;否则为 false。 默认值为 true

属性

示例

下面的代码示例演示如何使用 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);
// 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);

注解

Body类的 Message 属性表示消息的序列化内容。 正文最多可包含 4 MB 的数据。

适用于

另请参阅