YOUR FEEDBACK
johnpetersen wrote: Great post. You hit some good points, and hopefully me sending this post. It wil...

SYS-CON.TV
TOP MICROSOFT .NET LINKS


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.

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.
MICROSOFT .NET LATEST STORIES
In a move that looks tailor-made for an antitrust suit, Microsoft says it’s going to give away a consumer security kit that it’s building code named Morro. It should be available in the second half of next year – probably more like mid-year. The freebie widgetry is supposed to de...
OpenSpan and TIBCO have announced a technology and business partnership designed to extend TIBCO solutions to desktop environments. The partnership will enable TIBCO Service-Oriented Architecture, Business Process Management and Business Optimization solutions to more rapidly integrate...
Tidal Software has announced Intersperse 8.0, a product that monitors J2EE and .NET applications and their transaction component performance to produce meaningful metrics for managing applications and high-level business processes. The product leverages a combination of lightweight Ja...
DataGuise has announced their first masking in place solution for multi-database environments such as Oracle, Microsoft SQL Server, and others. The dgSolution Suite provides secure masking of database content and is designed for the highest level of flexibility and functionality across...
The BlackBerryR Technical Webcast Series is designed to help BlackBerry administrators better manage and leverage the capabilities of their BlackBerry solution. Each webcast is packed with detailed technical information, covering topics that are relevant to you. Our on-demand webcasts ...
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 NEWS FROM THE WIRES
Collexis Holdings, Inc. (OTC Bulletin Board: CLXS), a leading developer of semantic search and knowl...