There are three kind of collections supported inside the .NET Framework. In this recipe, we will be focusing on using these collections inside a .NET Standard 2.0 library. In general, collections are used to manage groups of related objects. Creating arrays of objects is a way of grouping related objects. But our focus is on using these collections, which is the second method of grouping related objects.
These are the three kinds of collections we have in .NET Framework:
System.Collections.Generic
ClassesSystem.Collections.Concurrent
ClassesSystem.Collections
Classes
Let's have a look at these and their usage inside a .NET Standard 2.0 library.
- Open Visual Studio 2017.
- Click
File
|New
|Project
and, in theNew Project
template dialog box, selectVisual Studio Solutions
under theOther Project Types
node in the left-hand pane, and thenBlank Solution
in the right-hand pane. - In the
Name:
text box, typeChapter2.Collections
as the name of the solution...