Share via


MessageQueuePermissionAttribute.Label 属性

定义

获取或设置队列说明。

public:
 property System::String ^ Label { System::String ^ get(); void set(System::String ^ value); };
public string Label { get; set; }
member this.Label : string with get, set
Public Property Label As String

属性值

消息队列的标签。

例外

该值为 null

示例

下面的代码示例获取并设置消息队列权限属性的值 Label


// Connect to a queue on the local computer.
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue");

// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute^ attribute =
    gcnew MessageQueuePermissionAttribute(
    System::Security::Permissions::SecurityAction::Assert);

// Set the attribute's Label property value, based on the queue's Label
// property value.
attribute->Label = queue->Label;

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

queue->Close();

// Connect to a queue on the local computer.
MessageQueue queue = new MessageQueue(".\\exampleQueue");

// Create a new instance of MessageQueuePermissionAttribute.
MessageQueuePermissionAttribute attribute =
    new MessageQueuePermissionAttribute(
    System.Security.Permissions.SecurityAction.Assert);

// Set the attribute's Label property value, based on the queue's Label
// property value.
attribute.Label = queue.Label;

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

适用于