Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MessageQueuePermissionEntryCollection::Item Property (Int32)

 

Gets or sets the object at a specified index.

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

public:
property MessageQueuePermissionEntry^ default[
	int index
] {
	MessageQueuePermissionEntry^ get(int index);
	void set(int index, MessageQueuePermissionEntry^ value);
}

Parameters

index
Type: System::Int32

The zero-based index into the collection.

Property Value

Type: System.Messaging::MessageQueuePermissionEntry^

The MessageQueuePermissionEntry that exists at the specified index.

The following code example demonstrates the use of 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();

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft