A top-level statement is C# code written directly in a source file without an explicit Program class or Main method. The compiler generates the entry point for you, making startup code shorter and easier to read. section 3.6
A minimal application
Console.WriteLine("Hello World!"); writes the application body directly in the file. The args variable is also available for command-line arguments, even though it is not declared explicitly. section 3.6
Listing 3.3 The default Program.cs file that configures and runs a WebApplication
WebApplicationBuilder builder = WebApplication.CreateBuilder(args); #1
WebApplication app = builder.Build(); #2
app.MapGet("/", () => "Hello World!"); #3
app.Run(); #4
The default ASP.NET Core Program.cs uses top-level statements to create a WebApplicationBuilder, build the application, map a route, and start the server. section 3.6
