O'Reilly logo

Professional C# 5.0 and .NET 4.5.1 by Morgan Skinner, Jay Glynn, Christian Nagel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10Collections

WHAT’S IN THIS CHAPTER?

  • Understanding collection interfaces and types
  • Working with lists, queues, and stacks
  • Working with linked and sorted lists
  • Using dictionaries and sets
  • Using bit arrays and bit vectors
  • Using immutable and concurrent collections
  • Evaluating performance

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at www.wrox.com/go/procsharp on the Download Code tab. The code for this chapter is divided into the following major examples:

  • List Samples
  • Queue Sample
  • Linked List Sample
  • Sorted List Sample
  • Dictionary Sample
  • Set Sample
  • Observable Collection Sample
  • BitArray Sample
  • Immutable Collections Sample
  • Pipeline Sample

OVERVIEW

In Chapter 6, “Arrays and Tuples,” you learned about arrays and the interfaces implemented by the Array class. The size of arrays is fixed. If the number of elements is dynamic, you should use a collection class instead of an array.

List<T> is a collection class that can be compared to arrays; but there are also other kinds of collections: queues, stacks, linked lists, dictionaries, and sets. The other collection classes have partly different APIs to access the elements in the collection and often a different internal structure for how the items are stored in memory. This chapter covers all of these collection classes and their differences, including performance differences.

You can also read about bit arrays and concurrent collections that can be used from multiple threads. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required