What’s In This Chapter?
Wrox.com Code Downloads for This Chapter
The wrox.com code downloads for this chapter are found at http://www.wrox.com/go/professionalcsharp6 on the Download Code tab. The code for this chapter is divided into the following major examples:
Chapter 11, “Collections,” covers lists, queues, stacks, dictionaries, and linked lists. This chapter continues with special collections, such as collections for dealing with bits, collections that can be observed when changed, collections that cannot be changed, and collections that can be accessed from multiple threads simultaneously.
If you need to deal with a number of bits, you can use the class BitArray and the struct BitVector32 . BitArray is located in the namespace System.Collections, and BitVector32 is in the namespace System.Collections.Specialized. The most important difference between these two types is that BitArray is resizable—which is useful if you don’t have advance knowledge of the number of bits needed—and it can contain a large number of bits. BitVector32 is stack-based and therefore faster. BitVector32 contains only 32 bits, which are stored in an integer.
The class BitArray is a reference type that contains ...