MessageQueuePermissionEntryCollection.AddRange Method (MessageQueuePermissionEntry[])

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Appends a set of specified permission entries to this collection.

Namespace:   System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

public void AddRange(
	MessageQueuePermissionEntry[] value
)

Parameters

value
Type: System.Messaging.MessageQueuePermissionEntry[]

An array of type MessageQueuePermissionEntry objects that contains the permission entries to add.

The following code example demonstrates the use of AddRange(MessageQueuePermissionEntry[]).

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

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

// Get an instance of MessageQueuePermissionEntryCollection from the
// permission's PermissionEntries property.
MessageQueuePermissionEntryCollection collection =
    permission.PermissionEntries;

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

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

// Add the array to the collection.
collection.AddRange(entries);

.NET Framework
Available since 1.1
Return to top
Show: