Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In C#, a collection is a data structure that holds data in an indexed way for ease of storage and retrieval. It can be thought of as a related group of variables that can be accessed individually; examples may include a collection of exam results or a list surnames for a class register. A collection removes the requirement for a separate variable to store each value and most collections provide greatly simplified methods for performing common operations across the collection as a whole, such as sorting, iteration, etc.
Many different types of collection are available to the C# programmer. As I have mentioned before, this chapter has been designed to give you a working knowledge of the language, sufficient only to allow you to progress through the rest of the book, so we will cover just the most commonly used collection types here.