共用方式為


MessagePropertyFilter.TimeToBeReceived 屬性

定義

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

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

屬性值

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

屬性

範例

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

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

備註

類別 TimeToBeReceivedMessage 屬性會指定要從目的地佇列接收之已傳送訊息的總時間,以秒為單位。 要從目標佇列擷取之訊息的時間限制包括取得目的地佇列所花費的時間,以及應用程式擷取訊息之前在佇列中等候的時間。

適用於

另請參閱