Using the Azure SDK for .NET, you need a simple way to retrieve an approximate count of messages in a queue named queue1. Which method requires the least development effort to get that approximate number?
Choose an answer
Tap an option to check your answer.
Correct answer: GetProperties method of the QueueClient class.
Why this is the answer
The GetProperties method of the QueueClient class provides queue metadata, including an approximate message count, with minimal development effort. This method directly retrieves the ApproximateMessagesCount property, which is suitable for general monitoring and doesn't require processing individual messages. The GetProperties method of the QueueServiceClient class operates on the service level, not a specific queue, so it cannot provide a count for queue1. The PeekMessages method of the QueueClient class retrieves actual messages without removing them, which is not designed for counting and can be resource-intensive for large queues. The GetStatistics method is not a standard method for Azure Queue Storage clients in the .NET SDK.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed