共用方式為


MessageQueue.Label 屬性

定義

取得或設定佇列描述。

public:
 property System::String ^ Label { System::String ^ get(); void set(System::String ^ value); };
[System.Messaging.MessagingDescription("MQ_Label")]
public string Label { get; set; }
[<System.Messaging.MessagingDescription("MQ_Label")>]
member this.Label : string with get, set
Public Property Label As String

屬性值

訊息佇列的標籤。 預設為空字串(“”)。

屬性

例外狀況

標籤被設定為無效值。

存取訊息佇列方法時發生錯誤。

範例

以下範例程式碼取得 Label 並設定訊息佇列屬性的值。

// Set the queue's Label property value.
queue.Label = "Example Queue";

// Display the new value of the queue's Label property.
Console.WriteLine("MessageQueue.Label: {0}",
    queue.Label);

備註

訊息佇列標籤的最大長度為 124 個字元。

Label屬性不需要在所有佇列中都是唯一的。 然而,如果多個佇列共用相同 Label,你就無法用這個 Send(Object) 方法向所有佇列廣播訊息。 如果你在傳送訊息時使用屬性的標籤語法 Path ,當 不是 Label 唯一時,會拋出例外。

下表顯示此特性是否在各種工作群組模式中可用。

工作群組模式 有現貨
本機電腦 是的
本地電腦與直接格式名稱 是的
遠端電腦 No
遠端電腦與直接格式名稱 No

適用於

另請參閱