MessageQueue.QueueName 屬性

定義

取得或設定識別佇列的易記名稱。Gets or sets the friendly name that identifies the queue.

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

屬性值

String

名稱,識別這個 MessageQueue 所參考的佇列。The name that identifies the queue referenced by this MessageQueue. 這個值不能為 nullThe value cannot be null.

屬性

例外狀況

佇列名稱是 nullThe queue name is null.

範例

下列程式碼範例會取得並設定訊息佇列之屬性的值 QueueNameThe following code example gets and sets the value of a message queue's QueueName property.

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

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

備註

您可以結合 QueueNameMachineName 來建立佇列的易記 Path 名稱。You can combine the QueueName with the MachineName to create a friendly Path name for the queue. 屬性的易記名稱變化語法 Path 取決於佇列的類型,如下表所示。The syntax for the friendly name variation of the Path property depends on the type of queue, as shown in the following table.

佇列類型Queue type 語法Syntax
公用佇列Public queue MachineName\QueueName
私用佇列Private queue MachineName\Private$\QueueName
記錄檔佇列Journal queue MachineName\QueueName\Journal$

使用 "." 表示本機電腦。Use "." to represent the local computer.

變更 QueueName 屬性會影響 Path 屬性。Changing the QueueName property affects the Path property. 如果您在 QueueName 未設定屬性的情況下設定 MachineName ,則 Path 屬性會變成。 \ QueueNameIf you set the QueueName without setting the MachineName property, the Path property becomes .\QueueName. 否則, Path 會變成 MachineName \ QueueNameOtherwise, the Path becomes MachineName\QueueName.

下表顯示此屬性是否適用于各種工作組模式。The following table shows whether this property is available in various Workgroup modes.

工作組模式Workgroup mode 可用Available
本機電腦Local computer Yes
本機電腦和直接格式名稱Local computer and direct format name Yes
遠端電腦Remote computer Yes
遠端電腦和直接格式名稱Remote computer and direct format name No

適用於

另請參閱