C# Top level statements

Posted by Joe Enos on May 08, 2021 · 1 min read

In the newest version of C#, you can have top-level statements instead of putting your entry point in a "static void Main" method. This saves you a couple of indents for your application's starting point, which doesn't really belong in a class in the first place.

The compiler magically puts it in a special class and method, but you don't have to worry about that.

View code on GitHub