Mega Code Archive

 
Categories / C# Tutorial / Windows
 

Iterate through all the message queues in the network, and examines the path for each queue, displays the number of public queues

using System; using System.Messaging;     public class MyNewQueue     {         public static void Main()         {             uint numberQueues = 0;             MessageQueueEnumerator myQueueEnumerator = MessageQueue.GetMessageQueueEnumerator();             while(myQueueEnumerator.MoveNext())             {                 Console.WriteLine(myQueueEnumerator.Current.Path);                 numberQueues++;             }             Console.WriteLine("Number of public queues: " + numberQueues.ToString());         }     }