Chapter 19. C# collection classes

Collection classes are convenient classes acting as data structures for 'holding' multiple objects. Collection classes are often used instead of arrays because they have useful methods for manipulating the objects stored within. While not part of the C# language itself, I have included this chapter because collection classes are used very frequently.

Java 2 came with a whole set of useful collection classes so that we have more choices than java.util.Vector. The Java 2 Collection API includes classes in the java.util package such as Stack, LinkedList, Set, ArrayList, Vector, etc.

Of course the .NET framework comes with its own set of collection classes which can be used by any .NET language. They are found in the System.Collections namespace and include classes such as ArrayList, Queue, SortedList, and Stack. The following sections give a brief description of the more useful classes in System.Collections and examples of how they are used.

You can refer to the API documentation for more details on the classes and their other methods. The examples here are only meant to get you up and running with some of these classes quickly. The more commonly used methods are demonstrated and should be self-explanatory by their names.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.79.147