MessageQueuePermissionEntryCollection Class
Contains a strongly typed collection of MessageQueuePermissionEntry objects.
Assembly: System.Messaging (in System.Messaging.dll)
System.Collections::CollectionBase
System.Messaging::MessageQueuePermissionEntryCollection
| Name | Description | |
|---|---|---|
![]() | Capacity | Gets or sets the number of elements that the CollectionBase can contain.(Inherited from CollectionBase.) |
![]() | Count | Gets the number of elements contained in the CollectionBase instance. This property cannot be overridden.(Inherited from CollectionBase.) |
![]() | InnerList | Gets an ArrayList containing the list of elements in the CollectionBase instance.(Inherited from CollectionBase.) |
![]() | Item[Int32] | Gets or sets the object at a specified index. |
![]() | List | Gets an IList containing the list of elements in the CollectionBase instance.(Inherited from CollectionBase.) |
| Name | Description | |
|---|---|---|
![]() | Add(MessageQueuePermissionEntry^) | Adds a specified MessageQueuePermissionEntry to this collection. |
![]() | AddRange(array<MessageQueuePermissionEntry^>^) | Appends a set of specified permission entries to this collection. |
![]() | AddRange(MessageQueuePermissionEntryCollection^) | Appends a set of specified permission entries to this collection. |
![]() | Clear() | Removes all objects from the CollectionBase instance. This method cannot be overridden.(Inherited from CollectionBase.) |
![]() | Contains(MessageQueuePermissionEntry^) | Determines whether this collection contains a specified MessageQueuePermissionEntry. |
![]() | CopyTo(array<MessageQueuePermissionEntry^>^, Int32) | Copies the permission entries from this collection to an array, starting at a particular index of the array. |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetEnumerator() | Returns an enumerator that iterates through the CollectionBase instance.(Inherited from CollectionBase.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | IndexOf(MessageQueuePermissionEntry^) | Determines the index of a specified permission entry in this collection. |
![]() | Insert(Int32, MessageQueuePermissionEntry^) | Inserts a permission entry into this collection at a specified index. |
![]() | MemberwiseClone() | |
![]() | OnClear() | This API supports the product infrastructure and is not intended to be used directly from your code. Performs additional custom processes after clearing the contents of the collection.(Overrides CollectionBase::OnClear().) |
![]() | OnClearComplete() | Performs additional custom processes after clearing the contents of the CollectionBase instance.(Inherited from CollectionBase.) |
![]() | OnInsert(Int32, Object^) | This API supports the product infrastructure and is not intended to be used directly from your code. Performs additional custom processes before a new permission entry is inserted into the collection.(Overrides CollectionBase::OnInsert(Int32, Object^).) |
![]() | OnInsertComplete(Int32, Object^) | Performs additional custom processes after inserting a new element into the CollectionBase instance.(Inherited from CollectionBase.) |
![]() | OnRemove(Int32, Object^) | This API supports the product infrastructure and is not intended to be used directly from your code. Performs additional custom processes when removing a new permission entry from the collection.(Overrides CollectionBase::OnRemove(Int32, Object^).) |
![]() | OnRemoveComplete(Int32, Object^) | Performs additional custom processes after removing an element from the CollectionBase instance.(Inherited from CollectionBase.) |
![]() | OnSet(Int32, Object^, Object^) | This API supports the product infrastructure and is not intended to be used directly from your code. Performs additional custom processes before setting a value in the collection.(Overrides CollectionBase::OnSet(Int32, Object^, Object^).) |
![]() | OnSetComplete(Int32, Object^, Object^) | Performs additional custom processes after setting a value in the CollectionBase instance.(Inherited from CollectionBase.) |
![]() | OnValidate(Object^) | Performs additional custom processes when validating a value.(Inherited from CollectionBase.) |
![]() | Remove(MessageQueuePermissionEntry^) | Removes a specified permission entry from this collection. |
![]() | RemoveAt(Int32) | Removes the element at the specified index of the CollectionBase instance. This method is not overridable.(Inherited from CollectionBase.) |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | ICollection::CopyTo(Array^, Int32) | Copies the entire CollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.(Inherited from CollectionBase.) |
![]() ![]() | IList::Add(Object^) | Adds an object to the end of the CollectionBase.(Inherited from CollectionBase.) |
![]() ![]() | IList::Contains(Object^) | Determines whether the CollectionBase contains a specific element.(Inherited from CollectionBase.) |
![]() ![]() | IList::IndexOf(Object^) | Searches for the specified Object and returns the zero-based index of the first occurrence within the entire CollectionBase.(Inherited from CollectionBase.) |
![]() ![]() | IList::Insert(Int32, Object^) | Inserts an element into the CollectionBase at the specified index.(Inherited from CollectionBase.) |
![]() ![]() | IList::Remove(Object^) | Removes the first occurrence of a specific object from the CollectionBase.(Inherited from CollectionBase.) |
![]() ![]() | ICollection::IsSynchronized | Gets a value indicating whether access to the CollectionBase is synchronized (thread safe).(Inherited from CollectionBase.) |
![]() ![]() | ICollection::SyncRoot | Gets an object that can be used to synchronize access to the CollectionBase.(Inherited from CollectionBase.) |
![]() ![]() | IList::IsFixedSize | Gets a value indicating whether the CollectionBase has a fixed size.(Inherited from CollectionBase.) |
![]() ![]() | IList::IsReadOnly | Gets a value indicating whether the CollectionBase is read-only.(Inherited from CollectionBase.) |
![]() ![]() | IList::Item[Int32] | Gets or sets the element at the specified index.(Inherited from CollectionBase.) |
| Name | Description | |
|---|---|---|
![]() | AsParallel() | Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.) |
![]() | AsQueryable() | Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.) |
![]() | Cast<TResult>() | Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.) |
![]() | OfType<TResult>() | Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.) |
The following code example demonstrates the use of MessageQueuePermissionEntryCollection.
#using <System.Messaging.dll> #using <System.dll> using namespace System; using namespace System::Messaging; public ref class MessageQueuePermissionEntryCollectionExample { // Demonstrates: // public Int32 Add (MessageQueuePermissionEntry value) public: void AddExample() { // 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); queue->Close(); } // Demonstrates: // public Void AddRange (MessageQueuePermissionEntry[] value) public: void AddRangeExample1() { // 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 an array of type MessageQueuePermissionEntry. array<MessageQueuePermissionEntry^>^ entries = gcnew array<MessageQueuePermissionEntry^>(1); // Create a new instance of MessageQueuePermissionEntry and place the // instance in the array. entries[0] = gcnew MessageQueuePermissionEntry( MessageQueuePermissionAccess::Receive, queue->MachineName, queue->Label, queue->Category.ToString()); // Add the array to the collection. collection->AddRange(entries); queue->Close(); } // Demonstrates: // public Void AddRange (MessageQueuePermissionEntryCollection value) public: void AddRangeExample2() { // Connect to a queue on the local computer. MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); // Create a new instance of MessageQueuePermission. MessageQueuePermission^ permission = gcnew MessageQueuePermission(); // Create a new instance of MessageQueuePermissionEntry. MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( MessageQueuePermissionAccess::Receive, queue->MachineName, queue->Label, queue->Category.ToString()); // Add the entry to the permission's collection. permission->PermissionEntries->Add(entry); // Create another new instance of MessageQueuePermission. MessageQueuePermission^ newPermission = gcnew MessageQueuePermission(); // Use AddRange() to append the original permission's collection to the // new permission's collection. newPermission->PermissionEntries->AddRange( permission->PermissionEntries); // To show that AddRange() copies collections by value and not by // reference, we'll clear the original permission's collection, then // display a count of how many entries are in the original permission's // collection and how many entries are in the new permission's // collection. // Clear the original permission's collection. permission->PermissionEntries->Clear(); // The original permission now contains 0 entries, but the new // permission still contains 1 entry. Console::WriteLine("Original permission contains {0} entries.", permission->PermissionEntries->Count); Console::WriteLine("New permission contains {0} entries.", newPermission->PermissionEntries->Count); queue->Close(); } // Demonstrates: // public Boolean Contains (MessageQueuePermissionEntry value) public: void ContainsExample() { // 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); // Show that the collection contains the entry. Console::WriteLine("Collection contains first entry (true/false): {0}", collection->Contains(entry)); // Create another new instance of MessageQueuePermissionEntry. MessageQueuePermissionEntry^ newEntry = gcnew MessageQueuePermissionEntry( MessageQueuePermissionAccess::Send, queue->MachineName, queue->Label, queue->Category.ToString()); // Show that the collection does not contain the new entry. Console::WriteLine( "Collection contains second entry (true/false): {0}", collection->Contains(newEntry)); queue->Close(); } // Demonstrates: // public Void CopyTo (MessageQueuePermissionEntry[] array, Int32 index) public: void CopyToExample() { // 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 an array of type MessageQueuePermissionEntry. array<MessageQueuePermissionEntry^>^ entries = gcnew array<MessageQueuePermissionEntry^>(1); // Copy the collection to index 0 of the array. collection->CopyTo(entries, 0); // Show that the array now contains the entry. Console::WriteLine("entries[0].PermissionAccess: {0}", entries[0]->PermissionAccess); Console::WriteLine("entries[0].MachineName: {0}", entries[0]->MachineName); Console::WriteLine("entries[0].Label: {0}", entries[0]->Label); Console::WriteLine("entries[0].Category: {0}", entries[0]->Category); queue->Close(); } // Demonstrates: // public Int32 IndexOf (MessageQueuePermissionEntry value) public: void IndexOfExample() { // 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 index of the entry in the collection. Console::WriteLine("Collection contains entry at index: {0}", collection->IndexOf(entry)); queue->Close(); } // Demonstrates: // public Void Insert (Int32 index, MessageQueuePermissionEntry value) public: void InsertExample() { // 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(); } // Demonstrates: // public MessageQueuePermissionEntry Item [Int32 index] { get; set; } public: void ItemExample() { // 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(); } // Demonstrates: // public Void Remove (MessageQueuePermissionEntry value) public: void RemoveExample() { // 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); // Remove the entry from the collection. collection->Remove(entry); queue->Close(); } }; // Creates a new queue. void CreateQueue(String^ queuePath, bool transactional) { if (!MessageQueue::Exists(queuePath)) { MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); queue->Close(); } else { Console::WriteLine("{0} already exists.", queuePath); } } int main() { // Create a new instance of the class. MessageQueuePermissionEntryCollectionExample^ example = gcnew MessageQueuePermissionEntryCollectionExample(); // Create a non-transactional queue on the local computer. CreateQueue(".\\exampleQueue", false); // Demonstrate MessageQueuePermissionEntryCollection's members. example->AddExample(); example->AddRangeExample1(); example->AddRangeExample2(); example->ContainsExample(); example->CopyToExample(); example->IndexOfExample(); example->InsertExample(); example->ItemExample(); example->RemoveExample(); }
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.






