다음을 통해 공유


MessageQueuePermissionEntryCollection.Item[Int32] 속성

정의

지정된 인덱스에서 개체를 가져오거나 설정합니다.

public:
 property System::Messaging::MessageQueuePermissionEntry ^ default[int] { System::Messaging::MessageQueuePermissionEntry ^ get(int index); void set(int index, System::Messaging::MessageQueuePermissionEntry ^ value); };
public System.Messaging.MessageQueuePermissionEntry this[int index] { get; set; }
member this.Item(int) : System.Messaging.MessageQueuePermissionEntry with get, set
Default Public Property Item(index As Integer) As MessageQueuePermissionEntry

매개 변수

index
Int32

컬렉션에 포함된 인덱스(0부터 시작)입니다.

속성 값

지정한 인덱스에 있는 MessageQueuePermissionEntry입니다.

예제

다음 코드 예제에서는 Item[]의 사용법을 보여줍니다.

// 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);

// Display the entry's properties, using the collection's Item
// accessor.
Console::WriteLine("collection[0].PermissionAccess: {0}",
    collection[0]->PermissionAccess);
Console::WriteLine("collection[0].MachineName: {0}",
    collection[0]->MachineName);
Console::WriteLine("collection[0].Label: {0}", collection[0]->Label);
Console::WriteLine("collection[0].Category: {0}",
    collection[0]->Category);

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

// Display the entry's properties, using the collection's Item
// accessor.
Console.WriteLine("collection[0].PermissionAccess: {0}",
    collection[0].PermissionAccess);
Console.WriteLine("collection[0].MachineName: {0}",
    collection[0].MachineName);
Console.WriteLine("collection[0].Label: {0}", collection[0].Label);
Console.WriteLine("collection[0].Category: {0}",
    collection[0].Category.ToString());

적용 대상