O'Reilly logo

Introducing Visual C# 2010 by Adam Freeman

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 15. Generic and Anonymous Types

In this chapter, we will look at the C# support for generic and anonymous types. Anonymous types are relatively simple, so most of this chapter is dedicated to the much more complex and involved topic of generic types.

Understanding generic types requires a good understanding of regular C# types, so if you have skipped over the chapters before this one, I suggest you go back and read more closely. Chapters 1, 3, and 9 have particular bearing on this chapter, which is summarized in Table 15-1.

Table 15-1. Quick Problem/Solution Reference for Chapter 15

Problem

Solution

Listings

Create a class, struct, or interface that works with a type that is selected at instantiation.

Create and instantiate a generic class, struct, ...

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