通过


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 异常不唯一,将引发异常。

下表显示了此属性是否可用于各种工作组模式。

工作组模式 可用
本地计算机 是的
本地计算机和直接格式名称 是的
远程计算机
远程计算机和直接格式名称

适用于

另请参阅