Freigeben über


MessageQueuePermissionEntryCollection.Item-Eigenschaft

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

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

Syntax

'Declaration
Public Default Property Item ( _
    index As Integer _
) As MessageQueuePermissionEntry
'Usage
Dim instance As MessageQueuePermissionEntryCollection
Dim index As Integer
Dim value As MessageQueuePermissionEntry

value = instance(index)

instance(index) = value
public MessageQueuePermissionEntry this [
    int index
] { get; set; }
public:
property MessageQueuePermissionEntry^ default [int] {
    MessageQueuePermissionEntry^ get (int index);
    void set (int index, MessageQueuePermissionEntry^ value);
}
/** @property */
public MessageQueuePermissionEntry get_Item (int index)

/** @property */
public void set_Item (int index, MessageQueuePermissionEntry value)
JScript unterstützt die Verwendung von indizierten Eigenschaften, aber nicht die Deklaration von neuen indizierten Eigenschaften.

Parameter

  • index
    Der nullbasierte Index der Auflistung.

Eigenschaftenwert

Der am angegebenen Index vorhandene MessageQueuePermissionEntry.

Beispiel

Im folgenden Codebeispiel wird die Verwendung von Item veranschaulicht.

// 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());
// 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.get_PermissionEntries();
// Create a new instance of MessageQueuePermissionEntry.
MessageQueuePermissionEntry entry =
    new MessageQueuePermissionEntry(MessageQueuePermissionAccess.Receive,
    queue.get_MachineName(), queue.get_Label(),
    queue.get_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.get_Item(0).get_PermissionAccess());
Console.WriteLine("collection[0].MachineName: {0}",
    collection.get_Item(0).get_MachineName());
Console.WriteLine("collection[0].Label: {0}",
    collection.get_Item(0).get_Label());
Console.WriteLine("collection[0].Category: {0}",
    collection.get_Item(0).get_Category().ToString());

.NET Framework-Sicherheit

  • Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter .

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

MessageQueuePermissionEntryCollection-Klasse
MessageQueuePermissionEntryCollection-Member
System.Messaging-Namespace