Chapter 3. Generics ≠ Templates

In the early stages of introducing generics, there was a fair amount of confusion surrounding the scope and capabilities of this new language feature. Many developers jumped to the conclusion that generics would be the functional equivalent of C++ templates. And, while these two constructs share common heritage, they definitely cannot be viewed—in any respect—as being one in the same. It's important, especially for those with a template orientation, to understand how generics and templates differ. This information may also be helpful, in a more conceptual sense, to anyone transitioning to generics. Overall, after reading this chapter, you should come away with a much clearer picture of the fundamental differences that exist between generics and templates implementations.

Get Professional .NET 2.0 Generics 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.