O'Reilly logo

Professional Visual Basic 2012 and .NET 4.5 Programming by Todd Herman, Gastón Hillar, David McCarter, Rob Windsor, Billy Hollis, Bill Sheldon

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 7

Arrays, Collections, and Generics

What's in this chapter?

Working with arrays

Iteration (looping)

Working with collections

Generics

Nullable types

Generic collections

Generic methods

Covariance and contravariance

Wrox.com Code Downloads for this Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/remtitle.cgi?isbn=9781118314456 on the Download Code tab. The code is in the chapter 7 download and individually named according to the code filenames throughout the chapter.

In the beginning there were variables, and they were good. The idea that you map a location in memory to a value was a key to tracking a value. However, most people want to work on data as a set. Taking the concept of a variable holding a value, you've moved to the concept of a variable that could reference an array of values. Arrays improved what developers could build, but they weren't the end of the line.

Over time, certain patterns developed in how arrays were used. Instead of just collecting a set of values, many have looked to use arrays to temporarily store values that were awaiting processing, or to provide sorted collections. Each of these patterns started as a best practice for how to build and manipulate array data or to build custom structures that replicate arrays.

The computing world was very familiar with these concepts—for example, using a linked list to enable more flexibility regarding how data is sorted and retrieved. Patterns such as the stack (first in, last ...

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