-
Book Overview & Buying
-
Table Of Contents
An Atypical ASP.NET Core 5 Design Patterns Guide
By :
In this section, we will visit the following new features:
new expressions We will use the top-level statement to simplify some code samples, leading to one code file with less boilerplate code. Then we will dig into the new expressions that allow creating new instances with less typing. The init-only properties are the backbone of the record classes used in this chapter and are foundational to the MVU example presented in Chapter 18, A Brief Look into Blazor.
Starting from C# 9, it is possible to write statements before declaring namespaces and other members. Those statements are compiled to an emitted Program.Main method.
With top-level statements, a minimal .NET "Hello World" program now looks like this:
using System;
Console.WriteLine("Hello world!");
Unfortunately, we also need a project to run, so we have...