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.dll
assembly andSystem.Collections.Generic
namespace: 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.Concurrent
assembly and namespace: the types in this assembly and namespace are safe to use in multi-threaded scenarios (see Chapter 12 ...
Get C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition 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.