MessageQueuePermissionAttribute.MachineName 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置“消息队列”队列所在的计算机的名称。
public:
property System::String ^ MachineName { System::String ^ get(); void set(System::String ^ value); };
public string MachineName { get; set; }
member this.MachineName : string with get, set
Public Property MachineName As String
属性值
队列所在的计算机的名称。
例外
该值为 null
。
示例
下面的代码示例获取并设置消息队列权限属性的值 MachineName 。
// 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 MachineName property value, based on the queue's
// MachineName property value.
attribute->MachineName = queue->MachineName;
// Display the new value of the attribute's MachineName property.
Console::WriteLine("attribute->MachineName: {0}",
attribute->MachineName);
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 MachineName property value, based on the queue's
// MachineName property value.
attribute.MachineName = queue.MachineName;
// Display the new value of the attribute's MachineName property.
Console.WriteLine("attribute.MachineName: {0}",
attribute.MachineName);