O'Reilly logo

C# 7 and .NET Core Cookbook by Dirk Strauss

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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>(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required