Summary


This chapter introduced a very important new feature of .NET 2.0: generics. With generic classes you can create type-independent classes, and generic methods allow type-independent methods. Interfaces, structs, and delegates can be created in a generic way as well. Generics make new programming style possible. You've seen how algorithms, particularly actions and predicates, can be implemented to be used with different classes — and all type-safe. Generic delegates make it possible to decouple algorithms from collections.

A major use of generics is with collection classes. The framework has been extended with the namespace System.Collections.Generic that includes generic versions of the collection classes from the System.Collections namespace. You looked at using several generic collection classes such asList<T>, Queue<T>, and LinkedList<T>.

Other .NET Framework types include are Nullable<T>, EventHandler<TEventArgs>, and ArraySegment<T>.




Professional C# 2005
Pro Visual C++ 2005 for C# Developers
ISBN: 1590596080
EAN: 2147483647
Year: 2005
Pages: 351
Authors: Dean C. Wills

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