Collection

Another common task under programming is to store and manage ordered sets of elements. Some common examples are the list of open files in an application, the set of rows returned from a database query, the group of users allowed to access an application, and so on.

Typically, dealing with elements of a specific type is encapsulated in a new type. Such a type is called a collection type. A collection type essentially lets you treat a set of elements as a single unit.

The BCL defines many useful collection types under the System.Collections and System.Collections.Specialized namespaces. The following are some common examples:

  • ArrayList: An array of elements. The size of the array can grow dynamically.

  • BitArray: A variable-size compact ...

Get .NET Programming: A Practical Guide Using C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.