Storing Multiple Objects in Collections
Learn about common collection types and discover how to improve collection performance.
One of the most common types of data collection. We can use a collection if we need to store multiple values in a variable. A collection is a data structure in memory that can manage multiple items differently, although all collections have some shared functionality. The most common types in .NET for working with collections are shown in the following table:
Namespace | Example Type(s) | Description |
|
| Interfaces and base classes used by collections. |
|
| Introduced in C# 2.0 with .NET Framework 2.0. These collections allow you to specify the type we want to store using a generic type parameter (safer, faster, and more efficient). |
|
| These collections are safe to use in multithreaded scenarios. |
|
| Designed for scenarios where the contents of the original collection will never change, although they can create modified collections as a new instance. |