Understanding Generics
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| This article—Understanding Generics—is from Pro C# 2005 and the .NET 2.0 Platform, by Andrew Troelsen. Copyright © 2006 Andrew Troelsen. All rights reserved. Reproduced by permission. This article has been edited especially for C# Online.NET. Read the book review! |
|
Understanding Generics
With the release of .NET 2.0, the C# programming language has been enhanced to support a new feature of the CTS termed generics. Simply put, generics provide a way for programmers to define “placeholders” (formally termed type parameters) for method arguments and type definitions, which are specified at the time of invoking the generic method or creating the generic type.
To illustrate this new language feature, this chapter begins with an examination of the
System.Collections.Generic namespace. Once you’ve seen generic support within the base class
libraries, in the remainder of this chapter you’ll examine how you can build your own generic members,
classes, structures, interfaces, and delegates.
|


