11Special Collections
OVERVIEW
Chapter 10, “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.
WORKING WITH BITS
If you need to deal with a number of bits, C# 7 has extensions like the binary literal and the number separator that are covered in Chapter 2, “Core C#,” and Chapter 6, “Operators and Casts.” When you work with binary data, you can also 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 ...
Get Professional C# 7 and .NET Core 2.0, 7th Edition 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.