Last Updated: May 22, 2026
Top-level statements (C# 9) let a single file declare a program's entry point without writing class Program or static void Main. The compiler still emits a Program class with a Main method behind the scenes, so the runtime sees the same shape as before. This lesson digs into what the compiler generates, how args, return codes, and await work at the top level, and how to test the generated entry point.