title: Clearing azure service bus queue in one go
body: <p>We are using a service bus queue in our project. We are in need of a functionality to remove all the messages from the queue when the administrator chooses to clear the queue. I searched on the net but could not find any function which does this inside the <code>QueueClient</code> class.</p>
  
  <p>Do I have to pop all the messages one by one and then marking them complete to clear the queue or is there a better way?</p>
  
  <pre><code>QueueClient queueClient = _messagingFactory.CreateQueueClient(
                                queueName, ReceiveMode.PeekLock);
  
  BrokeredMessage brokeredMessage = queueClient.Receive();
  
  while (brokeredMessage != null )
  {
      brokeredMessage.Complete();
      brokeredMessage = queueClient.Receive();
  }
  </code></pre>