Top Level Statements
Modern C# lets a file start directly with statements, with no Main method or class. The compiler wraps them for you.
Example
Console.WriteLine("Hello");
var year = 2026;
Console.WriteLine($"Year {year}");Exercise
Print a line.
Console.("Hi");
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.