MessageQueuePermissionEntryCollection::Insert Method (Int32, MessageQueuePermissionEntry^)
.NET Framework (current version)
Inserts a permission entry into this collection at a specified index.
Assembly: System.Messaging (in System.Messaging.dll)
Parameters
- index
-
Type:
System::Int32
The zero-based index into the collection at which to insert the permission entry.
- value
-
Type:
System.Messaging::MessageQueuePermissionEntry^
The permission entry to insert into this collection.
The following code example demonstrates the use of Insert.
// Connect to a queue on the local computer. MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); // Create a new instance of MessageQueuePermission. MessageQueuePermission^ permission = gcnew MessageQueuePermission(); // Get an instance of MessageQueuePermissionEntryCollection from the // permission's PermissionEntries property. MessageQueuePermissionEntryCollection^ collection = permission->PermissionEntries; // Create a new instance of MessageQueuePermissionEntry. MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( MessageQueuePermissionAccess::Receive, queue->MachineName, queue->Label, queue->Category.ToString()); // Add the entry to the collection. collection->Add(entry); // Create another new instance of MessageQueuePermissionEntry. MessageQueuePermissionEntry^ newEntry = gcnew MessageQueuePermissionEntry( MessageQueuePermissionAccess::Send, queue->MachineName, queue->Label, queue->Category.ToString()); // Insert the new entry into the collection before the original entry. collection->Insert(0, newEntry); queue->Close();
.NET Framework
Available since 1.1
Available since 1.1
Show: