共用方式為


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

屬性值

true 表示接收 Body 資訊,否則為 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);

備註

類別 BodyMessage 屬性代表訊息的串行化內容。 本文最多可包含 4 MB 的數據。

適用於

另請參閱