Using Queues

Queues work much as they sound—they are first-in, first-out (FIFO) collections, like when you stand in line for tickets. These collections are good when you have a group of objects you want to process as they come in, such as when you receive client requests to connect to a Web service. Queues are supported with the Queue class. You can see the significant public properties of Queue objects in Table 6.7, and their significant public methods in Table 6.8. You use the Enqueue method to add items to the end of a queue and Dequeue to remove the first item from the front of the queue.

Table 6.7. Significant Public Properties of Queue Objects
PROPERTYPURPOSE
CountReturns the number of elements contained in the queue.
IsSynchronizedReturns ...

Get Microsoft® Visual C#® .NET 2003 Kick Start now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.