MessageQueuePermissionAttribute.MachineName 屬性

定義

取得或設定訊息佇列位置的電腦名稱。

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);

適用於