共用方式為


MessagePropertyFilter.Id 屬性

定義

取得或設定值,指出在接收或窺視訊息時是否要擷取 Id 屬性資訊。

public:
 property bool Id { bool get(); void set(bool value); };
[System.Messaging.MessagingDescription("MsgId")]
public bool Id { get; set; }
[<System.Messaging.MessagingDescription("MsgId")>]
member this.Id : bool with get, set
Public Property Id As Boolean

屬性值

true 表示接收 Id 資訊,否則為 false。 預設為 true

屬性

範例

下列程式代碼範例示範 屬性的使用 Id

// Set the queue's MessageReadPropertyFilter property 
// to enable the message's Id property.
queue->MessageReadPropertyFilter->Id = 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 Id property.
Console::WriteLine("Message.Id: {0}", orderMessage->Id);
// Set the queue's MessageReadPropertyFilter property to enable the
// message's Id property.
queue.MessageReadPropertyFilter.Id = 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 Id property.
Console.WriteLine("Message.Id: {0}",
    orderMessage.Id);

備註

類別 IdMessage 屬性表示訊息的 Message Queuing 產生的唯一標識碼。 傳送訊息時會產生此標識碼。

適用於

另請參閱