Storing multiple objects in collections
Another of the most common types of data is collections. If you need to store multiple values in a variable, then you can use a collection.
A collection is a data structure in memory that can manage multiple items in different ways, although all collections have some shared functionality.
The most common types in .NET for working with collections are shown in Table 8.9:
Namespace | Example types | Description |
System .Collections |
|
Interfaces and base classes used by collections. |
System .Collections .Generic |
|
Introduced in C# 2.0 with .NET Framework 2.0. These collections allow you to specify the type you want to store using a generic type parameter (which is safer, faster, and more efficient). |
System .Collections .Concurrent |
|
These collections are safe to use in multithreaded scenarios... |