Редактиране

Споделяне чрез


MessageQueuePermission Constructors

Definition

Initializes a new instance of the MessageQueuePermission class.

Overloads

MessageQueuePermission()

Initializes a new instance of the MessageQueuePermission class.

MessageQueuePermission(MessageQueuePermissionEntry[])

Initializes a new instance of the MessageQueuePermission class with the specified permission access level entries.

MessageQueuePermission(PermissionState)

Initializes a new instance of the MessageQueuePermission class with the specified permission state.

MessageQueuePermission(MessageQueuePermissionAccess, String)

Initializes a new instance of the MessageQueuePermission class with the specified access levels and the path of the queue.

MessageQueuePermission(MessageQueuePermissionAccess, String, String, String)

Initializes a new instance of the MessageQueuePermission class with the specified access levels, computer to use, queue description, and queue category.

MessageQueuePermission()

Initializes a new instance of the MessageQueuePermission class.

public:
 MessageQueuePermission();
public MessageQueuePermission ();
Public Sub New ()

Examples

The following code example creates a new instance of MessageQueuePermission.

// Create a new instance of MessageQueuePermission.
MessageQueuePermission permission = new MessageQueuePermission();

Applies to

MessageQueuePermission(MessageQueuePermissionEntry[])

Initializes a new instance of the MessageQueuePermission class with the specified permission access level entries.

public:
 MessageQueuePermission(cli::array <System::Messaging::MessageQueuePermissionEntry ^> ^ permissionAccessEntries);
public MessageQueuePermission (System.Messaging.MessageQueuePermissionEntry[] permissionAccessEntries);
new System.Messaging.MessageQueuePermission : System.Messaging.MessageQueuePermissionEntry[] -> System.Messaging.MessageQueuePermission
Public Sub New (permissionAccessEntries As MessageQueuePermissionEntry())

Parameters

permissionAccessEntries
MessageQueuePermissionEntry[]

An array of MessageQueuePermissionEntry objects. The PermissionEntries property is set to this value.

Examples

The following code example creates a new instance of MessageQueuePermission.

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

    // Create an array of type MessageQueuePermissionEntry.
    MessageQueuePermissionEntry[] entries =
        new MessageQueuePermissionEntry[1];

    // Create a new instance of MessageQueuePermissionEntry and place the
    // instance in the array.
string machineName = queue.MachineName;
string label = queue.Label;
    entries[0] = new MessageQueuePermissionEntry(
        MessageQueuePermissionAccess.Receive,
        machineName,
        label,
        queue.Category.ToString());

    // Create a new instance of MessageQueuePermission.
    MessageQueuePermission permission = new MessageQueuePermission(
        entries);

Applies to

MessageQueuePermission(PermissionState)

Initializes a new instance of the MessageQueuePermission class with the specified permission state.

public:
 MessageQueuePermission(System::Security::Permissions::PermissionState state);
public MessageQueuePermission (System.Security.Permissions.PermissionState state);
new System.Messaging.MessageQueuePermission : System.Security.Permissions.PermissionState -> System.Messaging.MessageQueuePermission
Public Sub New (state As PermissionState)

Parameters

state
PermissionState

One of the PermissionState values.

Examples

The following code example creates a new instance of MessageQueuePermission.

// Create a new instance of MessageQueuePermission.
MessageQueuePermission permission = new MessageQueuePermission(
    System.Security.Permissions.PermissionState.Unrestricted);

See also

Applies to

MessageQueuePermission(MessageQueuePermissionAccess, String)

Initializes a new instance of the MessageQueuePermission class with the specified access levels and the path of the queue.

public:
 MessageQueuePermission(System::Messaging::MessageQueuePermissionAccess permissionAccess, System::String ^ path);
public MessageQueuePermission (System.Messaging.MessageQueuePermissionAccess permissionAccess, string path);
new System.Messaging.MessageQueuePermission : System.Messaging.MessageQueuePermissionAccess * string -> System.Messaging.MessageQueuePermission
Public Sub New (permissionAccess As MessageQueuePermissionAccess, path As String)

Parameters

permissionAccess
MessageQueuePermissionAccess

One of the MessageQueuePermissionAccess values.

path
String

The path of the queue that is referenced by the MessageQueue.

Examples

The following code example creates a new instance of MessageQueuePermission.

// Create a new instance of MessageQueuePermission.
MessageQueuePermission permission = new MessageQueuePermission(
    MessageQueuePermissionAccess.Receive,
    ".\\exampleQueue");

Applies to

MessageQueuePermission(MessageQueuePermissionAccess, String, String, String)

Initializes a new instance of the MessageQueuePermission class with the specified access levels, computer to use, queue description, and queue category.

public:
 MessageQueuePermission(System::Messaging::MessageQueuePermissionAccess permissionAccess, System::String ^ machineName, System::String ^ label, System::String ^ category);
public MessageQueuePermission (System.Messaging.MessageQueuePermissionAccess permissionAccess, string machineName, string label, string category);
new System.Messaging.MessageQueuePermission : System.Messaging.MessageQueuePermissionAccess * string * string * string -> System.Messaging.MessageQueuePermission
Public Sub New (permissionAccess As MessageQueuePermissionAccess, machineName As String, label As String, category As String)

Parameters

permissionAccess
MessageQueuePermissionAccess

One of the MessageQueuePermissionAccess values.

machineName
String

The name of the computer where the Message Queuing queue is located.

label
String

The queue description.

category
String

The queue category (Message Queuing type identifier).

Examples

The following code example creates a new instance of MessageQueuePermission.

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

    // Create a new instance of MessageQueuePermission.
string queueCategory = queue.Category.ToString();
string machineName = queue.MachineName;
string label = queue.Label;
    MessageQueuePermission permission = new MessageQueuePermission(
        MessageQueuePermissionAccess.Receive,
        machineName,
        label,
        queueCategory);

Applies to