Partilhar via


MessageQueuePermissionAttribute.CreatePermission Método

Definição

Cria a permissão com base nos níveis de acesso solicitados, na categoria, no rótulo, no nome do computador e no caminho definidos por meio das propriedades PermissionAccess, Category, Label, MachineName e Path no atributo.

public:
 override System::Security::IPermission ^ CreatePermission();
public override System.Security.IPermission CreatePermission ();
override this.CreatePermission : unit -> System.Security.IPermission
Public Overrides Function CreatePermission () As IPermission

Retornos

Um IPermission que representa a permissão criada.

Exemplos

O exemplo de código a seguir chama CreatePermission.


// 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 Path property value, based on the queue's Path
// property value.
attribute->Path = queue->Path;

// Get an IPermission interface by calling the attribute's
// CreatePermission() method.
System::Security::IPermission^ permission = attribute->CreatePermission();

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 Path property value, based on the queue's Path
// property value.
attribute.Path = queue.Path;

// Get an IPermission interface by calling the attribute's
// CreatePermission() method.
System.Security.IPermission permission = attribute.CreatePermission();

Aplica-se a