Chapter 5. Generic and Support Collections

After completing this chapter, you will be able to

  • Use the Queue(T) class.

  • Use the Stack(T) class.

  • Use the Dictionary(TKey, TValue) class.

  • Use the BitArray class.

  • Use the CollectionBase and DictionaryBase classes.

  • Use the HashSet(T) class.

  • Use SortedList(TKey,TValue) and SortedDictionary(TKey,TValue) classes.

Queue(T) Overview

The Queue(T) class is a generic implementation of a First In, First Out (FIFO) collection or queue, as discussed in Chapter 3.

The Queue(T) class uses an array for data storage in the same way that the QueuedArray(T) class does in Chapter 3

Pushing items onto a queue that has full capacity takes O(n) operations; otherwise it takes only O(1) operations. Popping an item from the queue always ...

Get Developer’s Guide to Collections in Microsoft® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.