Пример #1
0
		public int GetQueeuElementsCount(string pQueuePach)
		{
			// Holds the count of Lowest priority messages.
			int numberItems = 0;

			// Connect to a queue.
			MessageQueue myQueue = new MessageQueue(pQueuePach);
    
			// Get a cursor into the messages in the queue.
			MessageEnumerator myEnumerator = myQueue.GetMessageEnumerator();

			// Specify that the messages's priority should be read.
			myQueue.MessageReadPropertyFilter.Priority = true;

			// Move to the next message and examine its priority.
			while(myEnumerator.MoveNext())
			{
				// Increase the count if priority is Lowest.
				if(myEnumerator.Current.Priority == MessagePriority.Lowest)
                    
					numberItems++;
			}

	
            
			return numberItems;
		}