10.2. The Role of Generic Type Parameters

You can find generic classes, interfaces, structures, and delegates sprinkled throughout the .NET base class libraries, and these might be part of any .NET namespace.

NOTE

Only classes, structures, interfaces, and delegates can be written generically; enum types cannot.

When you see a generic item listed in the .NET Framework 4.0 SDK documentation or the Visual Studio 2010 object browser, you will notice a pair of angled brackets with a letter or other token sandwiched within. Figure 10-1 shows a number of generic items in the System.Collections.Generic namespace, including the highlighted List<T> class.

Figure 10.1. Generic Items Supporting Type Parameters

Formally speaking, you call these tokens ...

Get Pro C# 2010 and the .NET 4 Platform, Fifth 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.