Goodbye Unnecessary C# Ceremony Boilerplate

As of C# version 9, we were able to finally say goodbye to the unnecessary ceremony boilerplate. One thing that I found confusing when first learning to write code in C# was the amount of code required to perform a simple task, you know, take the Hello World example for example:

using System;
namespace HelloWorld
{
  class Program
    {
      static void Main(string[] args)
      {
        Console.WriteLine("Hello World!");
      }
    }
}

That is a lot of fluff just to tell the system to display one line of text. As of C# version 9, we no longer need to include so much code for top-level statements. Our old friend, Hello World may now be written as:

using System;
Console.WriteLine("Hello World!");

Those of you familiar with C# probably already know this since we are now on version 11. But newbies like me are only now discovering these updates as most courses, books, and tutorials have yet to cover all the changes from every release.

Content Protection by DMCA.com
CategoriesC#

Leave a Reply

Your email address will not be published. Required fields are marked *