
How it works...
Let's see what's going on behind the scenes. From steps 1 to 4, we created the base for the project. This base will help you to create the .NET Standard 2.0 library and the project that will be using that library. A blank solution is always a good starting point for any sort of project. In steps 5 to 10, we added the .NET Standard 2.0 library project to the blank solution and gave it a meaningful name. In steps 11 to 13, we changed the default class template name to a meaningful name.
In step 14, we created a reference to the System.Collections.Generics namespace. This will give you access to all the collections available under this namespace. In step 15, we used one generic collection object known as List<T>. In the next few lines, we added some string objects to the variable created. Finally, we returned the list collection, which is the same return type as the GetFruitsList() method. Then, in step 16, we did a quick build, and this will help us to check the syntax of the code. It's good practice to do a quick build for syntax checking.
Again, in step 17, we added another reference to the System.Collections namespace. Then, in step 18, we added a public method that returns an ArrayList(), which contains in System.Collections namespace. In the first line of the GetShopItems() method, we are creating an instance of the ArrayList() object, and, in the next few lines, we are adding a string object to the ArrayList() using its Add() method. Finally, in the last line, we are returning the array list stored in the variable. Then, in step 19, we did a quick build, and this will help us to check the syntax of the code. It's good practice to do a quick build for syntax checking.
The last kind is the System.Collections.Concurrent namespace. This namespace contains collections that are thread safe. It means multiple threads can safely add or remove items from these collections.