'How to check the Queue is empty or how many items are in it of Queued background service in ASP.NET Core?

I want to implement the QueueBackground service in asp.net core.

  1. I need to check the queue is empty or not?
  2. How to count the items which are in Queue?


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source