MessageQueuePermission 构造函数

定义

初始化 MessageQueuePermission 类的新实例。

重载

MessageQueuePermission()

初始化 MessageQueuePermission 类的新实例。

MessageQueuePermission(MessageQueuePermissionEntry[])

使用指定的权限访问级别项初始化 MessageQueuePermission 类的新实例。

MessageQueuePermission(PermissionState)

初始化具有指定权限状态的 MessageQueuePermission 类的一个新实例。

MessageQueuePermission(MessageQueuePermissionAccess, String)

使用指定的访问级别和队列路径初始化 MessageQueuePermission 类的新实例。

MessageQueuePermission(MessageQueuePermissionAccess, String, String, String)

使用指定的访问级别、要使用的计算机、队列说明和队列类别初始化 MessageQueuePermission 类的新实例。

MessageQueuePermission()

初始化 MessageQueuePermission 类的新实例。

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

示例

下面的代码示例创建 的新 MessageQueuePermission实例。

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

适用于

MessageQueuePermission(MessageQueuePermissionEntry[])

使用指定的权限访问级别项初始化 MessageQueuePermission 类的新实例。

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

参数

permissionAccessEntries
MessageQueuePermissionEntry[]

一个 MessageQueuePermissionEntry 对象数组。 PermissionEntries 属性被设置为该值。

示例

下面的代码示例创建 的新 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);

适用于

MessageQueuePermission(PermissionState)

初始化具有指定权限状态的 MessageQueuePermission 类的一个新实例。

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)

参数

state
PermissionState

PermissionState 值之一。

示例

下面的代码示例创建 的新 MessageQueuePermission实例。

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

另请参阅

适用于

MessageQueuePermission(MessageQueuePermissionAccess, String)

使用指定的访问级别和队列路径初始化 MessageQueuePermission 类的新实例。

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)

参数

path
String

MessageQueue 引用的队列的路径。

示例

下面的代码示例创建 的新 MessageQueuePermission实例。

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

适用于

MessageQueuePermission(MessageQueuePermissionAccess, String, String, String)

使用指定的访问级别、要使用的计算机、队列说明和队列类别初始化 MessageQueuePermission 类的新实例。

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)

参数

machineName
String

“消息队列”队列所在的计算机的名称。

label
String

队列说明。

category
String

队列类别(消息队列类型标识符)。

示例

下面的代码示例创建 的新 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);

适用于