C# Generics vs. C++ Templates

Thursday, December 16, 2004 - 7:00pm
Richard Hale Shaw

The 2005 release of the .NET Framework - and the C# language - will proffer a feature of great interest to C++ developers who're interested in .NET: Generics. Generics - like C++ templates - let you create types or methods that are - in one or more respects - typeless when defined, but available to be strongly typed when used and consumed. Unlike C++ templates, however, Generics are not a facet of a programming language like C++ (or C#), but instead are a product of the .NET Common Language Runtime (CLR). How do Generics differ from C++ templates? Can they be used to solve the same problems - or not? And, will the appearance of Generics mean that .NET will follow with a STL-like library for C# (and VB.NET) developers to use? In this session, we'll look at Generics: what they are, how they work, and what you can do with them. We'll also look at the .NET model for generic type instantiation, and compare it to template instantiation in C++. And we'll compare and contrast these similar - but fundamentally different - models for creating parameterized types, as well as the implications of Generics on .NET Reflection and Metadata, Collections and Remoting.

Lecturer Biography: 

Richard Hale Shaw is a Microsoft MVP for C#, and a consultant and lecturer who focuses on Managed Code development of distributed systems with the C# Language and the .NET Framework. He's a frequent INETA speaker (www.ineta.org), Chair of C# Live (www.vslive.com), and the CEO of the Richard Hale Shaw Group (http://www.RichardHaleShawGroup.com). Richard taught himself to program in C (and later, C++) in 1982, and began writing and speaking on contemporary software development topics as a contributing editor to PC Magazine and Microsoft Systems Journal (now MSDN Magazine) in 1988. He's consulted to 1000s of developers on C++, MFC, COM, ATL, .NET and C#, and authored the .NET BootCamp (a 5-day hands-on course), the .NET Patterns & Practices BootCamp, and the Advanced .NET BootCamp. Over the years, Richard has created and organized a number of developer events (e.g., the Visual C++ Conference). In the Boston area, he's also known as a groove bass player specializing in Classic Soul and Funk, as well as light Jazz.