Comments
Patrick Collands wrote: collands (AT) gmail com I'd be very grateful for an invitation. Thank you.
Cloud Expo on Google News

SYS-CON.TV

2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Click For 2008 West
Event Webcasts
Book Review: "Microsoft .NET 2.0 Generics"
Everything you need to know about this powerful new feature

.NET 2.0 Generics is my favorite book of 2005. Well, other than Harry Potter anyway. This book is not for new programmers. To understand this book, I would recommend that you have about a year of programming experience, and at least six months with C++, C#, or Java. This book is well written and is best used as an introduction to generics, so it is of most use to an advanced beginner. The reader should be familiar the syntax of a C-derived language such as C++, Java, or C# 1.x, and be familiar with object oriented-programming issues such as inheritance, overloading, and overriding. No knowledge of generics is needed to make use of this book.

On the other hand, unless you are a wizard with .NET generics, you are likely to learn a lot from this book. For example, C++ programmers: What is the difference between templates and generics? The easy answer is that templates work at compile time, and generics work at run time, but there is a short chapter that details the real differences. Although most of the book concentrates on C# and VB.NET, there are two chapters that detail the nuances of using generics with C++ and J#. The C++ chapter also discuses how to combine templates and generics together to get the best of both worlds, and has a short discussion on the STL.NET library that actually makes use of the combination.

The book starts off discussing the way collections in .NET 1.1 work by having members be objects, and how the need to cast types to and from objects clutters and complicates programs. It then shows how generics can clean up the clutter and make programs clearer and more flexible. It is also pointed out that the complexity of templates in C++ has to some extent given generics a bad name, and how generics, although not quite as powerful as templates, keep some of this complexity at bay. It then covers simple generic classes and follows up with chapters on generic methods and generic delegates. It also covers constraints, which allow only types with certain attributes or capabilities to be added to the collection. An example is a generic container that is meant to hold data table objects, and is given constraints that require any object added to it to have sort and update methods.

The book also contains an advanced chapter on how generics can be created or analyzed using reflection, how they are serialized and deserialized, and how they work with remoting and Web services.

For those who want to know what is happening "under the hood," this book has a chapter that gives details on how compilers and the run time implement and execute generics, and shows how the use of generics affects code speed and size.

There are three chapters in this book from which I expect to get heavy use as a reference on a day-to-day basis. The first is a chapter on BCL generics, or the generic classes that come with the .NET Framework. Most of these are container classes, and this chapter covers how they work, including how to add, access, and remove items to each type of generic collection. The second chapter I expect to reference almost daily covers the "Power Collections" sponsored by Wintellect at www.Wintellect.com. There are several open source projects creating generic collections for .NET (as well as a lot of private companies doing the same). Of these, Power Collections is one of the larger and better known, and they also work closely with Microsoft (rumors are that the best and most popular of the Power Collection will be included in future versions of the .NET Framework). There is a long chapter at the end of the book that covers the Power Collections in the same way the earlier chapter covers the current .NET generics.

The third chapter that will get continued use from me is a set of rules and principles to apply when creating your own generic classes. A key premise of this book is that generics are so powerful that you should not only use the ones provided by Microsoft and others, but you should also create new ones as a part of all of your applications, just as you do classes. The rules in the Generics guidelines chapter distill a lot of experience with generics and can help programmers avoid many of the most common mistakes.

This is a must-have book for anyone using .NET 2.0.

About Dennis Hayes
Dennis Hayes is a programmer at Georgia Tech in Atlanta Georgia where he writes software for the Adult Cognition Lab in the Psychology Department. He has been involved with the Mono project for over six years, and has been writing the Monkey Business column for over five years.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

.NET 2.0 Generics is my favorite book of 2005. Well, other than Harry Potter anyway. This book is not for new programmers. To understand this book, I would recommend that you have about a year of programming experience, and at least six months with C++, C#, or Java. This book is well written and is best used as an introduction to generics, so it is of most use to an advanced beginner. The reader should be familiar the syntax of a C-derived language such as C++, Java, or C# 1.x, and be familiar with object oriented-programming issues such as inheritance, overloading, and overriding. No knowledge of generics is needed to make use of this book.


Your Feedback
SYS-CON Australia News Desk wrote: .NET 2.0 Generics is my favorite book of 2005. Well, other than Harry Potter anyway. This book is not for new programmers. To understand this book, I would recommend that you have about a year of programming experience, and at least six months with C++, C#, or Java. This book is well written and is best used as an introduction to generics, so it is of most use to an advanced beginner. The reader should be familiar the syntax of a C-derived language such as C++, Java, or C# 1.x, and be familiar with object oriented-programming issues such as inheritance, overloading, and overriding. No knowledge of generics is needed to make use of this book.
Latest Cloud Developer Stories
CloudBench Applications, Inc. announced its financial results for the three months and nine months ending September 30, 2009. All amounts are stated in Canadian dollars unless otherwise noted. Revenues from BasicGov, the Company's cloud computing solution for local government, gr...
The new contract is an industry first, with CSC being the first Microsoft partner to lead and win a cloud computing services agreement of this scale. Under terms of the contract, CSC will provide Royal Mail Group's 30,000 employees with access to new IT services using Microsoft's...
Operates in over 170 countries and is one of the world’s leading providers of communications solutions and services. Richard Tarboton talks for MeettheBoss.TV on his role as Head of Energy & Carbon for BT and what they are doing towards reducing carbon emissions.
CA is going to put its Agile Planner software on salesforce.com’s Force.com platform in the first half to accelerate development time and give users visibility over their development initiatives to reduce time-to-market. Customers are supposed to be able to accelerate the deploym...
Despite its uncertain fate Sun soldiers on. Monday it trotted out a cloud-based multiplatform desktop as a service for K-12 and community colleges that can run Windows, the Mac OS, Linux and Solaris applications to nearly any client device, including its own Sun Ray thin clients....
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE

Breaking Cloud Computing News
CloudBench Applications, Inc. announced its financial results for the three months and nine months e...