How to do it...

  1. In your console application, add a new class called DotNet. To this class, add a property called AvailableDatatype:
        public class DotNet         {           public string  AvailableDatatype { get; set; }         }
  1. In the main program class, add a new static action event called types. Basically, this is just a delegate and will receive some value; in our case, the available .NET data types:
        class Program         {           // Static action event           static event Action<string> types;           static void Main(string[] args)           {           }         }
  1. Inside void Main, create a List<DotNet> class called lstTypes. Inside this list, add several values of type DotNet class. Here, we will just add hardcoded data of some of the data types in .NET:
 List<DotNet> lstTypes = new List<DotNet>(); ...

Get C# 7 and .NET Core Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.