New Features in C# 2.0—Implement the Collection Interfaces
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:Tutorials |
| C# Tutorials |
| © 2005 O'Reilly Media, Inc. |
Implement the Collection Interfaces
In addition to its generic collection classes, .NET 2.0 also provides a set of
generic interfaces that enable you to create type-safe collections that
have all the functionality of the earlier, nongeneric .NET 1.x collection
types. You’ll find these interfaces in the System.Collections.Generic
namespace. The namespace also includes a number of related generic
interfaces, such as IComparable<T>, which you can use to compare two
objects of type T regardless of whether they are part of a collection.
You can create a sorted linked list by having each datatype stored in the
list implement the IComparable<T> interface and by having your Node
object be responsible for inserting each new Node at the correct (sorted)
position in the linked list.
|

