Top level statements were introduced in .NET 6 to reduce ‘boilerplate’ code but not everyone likes them. In .NET 7 Preview 4 there is a template option to not use top level statements when creating a new project.
More info from Microsoft ->
ASP.NET Core updates in .NET 7 Preview 4 – .NET Blog (microsoft.com)