Chapter 6. Introduction to Generics


In This Chapter

  • Overview of Generics

  • Building Generic Types

  • Using Generic Collections

Generics are a feature new to C# 2.0 that adds a tremendous amount of power and flexibility to object-oriented programming using the language. Many definitions of generics start off with a comparison of template-based programming in C++, but I feel that does generics an injustice.

Generics allow class designers to defer the specification of types within a class definition until such time as that class is instantiated. This chapter not only shows you how to use generics, but gives you a good idea of when you should use generics and how they can create drastic performance improvements and make code reuse significantly easier.

This chapter is by no means the definitive and complete guide for generics-based programming in C# 2.0. However, it will provide you with the information you need to know in order to quickly start using generics in your everyday coding as well as to understand the use of generics throughout the rest of the framework such as ASP.NET, ADO.NET, and so on.



Microsoft Visual C# 2005 Unleashed
Microsoft Visual C# 2005 Unleashed
ISBN: 0672327767
EAN: 2147483647
Year: 2004
Pages: 298

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net