Is there a way using C# to identify whether a private MSMQ has exceeded it's storage limit (KB)?
In the following example I created a private MSMQ using the Computer Management console and I set the storage limit to 100 KB.
I send messages to the queue using a simple c# program which works fine. I would like to be able to figure out when the limit has been reached in order to stop sending messages.
MessageQueue msgQ =new MessageQueue(".\\Private$\\name_of_queue");
msgQ.Send(msg);

Maximum Size of Queue
Use the MessageQueue.MaximumQueueSize Property to get the queue's maximum size.
So, something like this should work:
Size of Queue
Use the PerformanceCounter to get the current size of the queue:
Looks like there are two different queries to get the size of the current queue:
The above queries were found on MSDN in a now deprecated section of MSMQ Queue Object. However, I believe the queries are still valid.