다음을 통해 공유


MessageQueuePermissionEntryCollection.Insert 메서드

정의

이 컬렉션의 지정된 인덱스에 사용 권한 항목을 삽입합니다.

public:
 void Insert(int index, System::Messaging::MessageQueuePermissionEntry ^ value);
public void Insert (int index, System.Messaging.MessageQueuePermissionEntry value);
member this.Insert : int * System.Messaging.MessageQueuePermissionEntry -> unit
Public Sub Insert (index As Integer, value As MessageQueuePermissionEntry)

매개 변수

index
Int32

사용 권한 항목을 삽입할 컬렉션의 인덱스(0부터 시작)입니다.

value
MessageQueuePermissionEntry

이 컬렉션에 삽입할 사용 권한 항목입니다.

예제

다음 코드 예제에서는 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();
// 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 a new instance of MessageQueuePermissionEntry.
MessageQueuePermissionEntry entry = new 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 = new 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);

적용 대상