Freigeben über


MessageQueuePermissionEntryCollection.Item[Int32] Eigenschaft

Definition

Ruft das Objekt an einem angegebenen Index ab oder legt dieses fest.

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

Parameter

index
Int32

Der nullbasierte Index der Auflistung.

Eigenschaftswert

Der am angegebenen Index vorhandene MessageQueuePermissionEntry.

Beispiele

Das folgende Codebeispiel veranschaulicht die Verwendung von 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());

Gilt für: