Problem solve Get help with specific problems with your technologies, process and projects.

Book Excerpt: .NET 2.0 Generic classes

Generics bring a heavy dose of flexibility to .NET 2.0. This chapter download tells developers what they need to know before building generic classes.

The Generics class introduced in .NET 2.0 gives developers the flexibility to write methods once and then let the .NET Framework take care of type issues. This class is a tremendous asset -- there is no boxing of objects or casting of exceptions, which improves performance, compile errors show up earlier in the coding process, and generics are implemented right into the Common Language Runtime.

Professional .NET 2.0 Generics by Tod Golding covers many aspects of this implementation, from methods and delegates to reflection, serialization and remoting. Golding provides code samples in both VB and C# and also includes chapters for using generics in C++ and J#.

Chapter 4, Generic Classes, goes through the details associated with building generic classes in .NET 2.0. There are sections devoted to parameterizing types, inheritance, fields and methods. From there, Golding talks about the rules governing generic constructions, such as accessibility, nullable types, structs and interfaces.

Read the rest of the excerpt in this PDF.

MORE: Read Chapter 10 of this book, Generics Guidelines.


Excerpted from the Wrox Press book,  Professional .NET 2.0 Generics (ISBN 0-7645-5988-5) by Tod Golding.
Copyright © 2005. Published by John Wiley & Sons Inc.. Reprinted with permission.

Dig Deeper on .NET Framework 2.0 and Visual Studio 2005 development

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.