Storing data with 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.
There are three main assemblies and namespaces for collections:
System.Collections.Genericnamespace: The types in this assembly and namespace were introduced in C# 2 with .NET 2.0 and are better because they allow you to specify the type you want to store (which is safer, faster, and more efficient).
System.Collections.Concurrentassembly and namespace: the types in this assembly and namespace are safe to use in multi-threaded scenarios (see Chapter 12 ...