I have a console app targeting net5 and the only line of code in the app is this
System.Console.WriteLine();
It works as expected, but when I remove that line I get a compilation error pointing out that an entry point is missing. This is the error: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs5001
My question is why there is a difference in compiler behaviour. Why does the compiler, in this case, treat a top-level program differently from a non-top-level program, where a static 'Main' method would be present?