January 2003
Intermediate to advanced
896 pages
19h 58m
English
When you have selected the appropriate collection class for your application, you might still need to add functionality to the objects in the collection to achieve the desired results. For example, the Array and ArrayList classes give you the Sort method to sort objects into some order. However, when you call the Sort method, a run-time exception is thrown if the class of the elements in the collection does not support the IComparable interface.
If you want to support only a single sort order for your objects, you can implement the IComparable interface, which consists of a single method, CompareTo. When sorting, the system calls this method for a particular object in the collection to compare ...
Read now
Unlock full access