Home/Tutorials/C# (.NET)/Top-Level Statements & Console Output

0 of 3 saved

C# (.NET)5 min read

Top-Level Statements & Console Output

Read this chapter, write the program on this page, then pass a short check to open the next one.

Print with Console.WriteLine.

Top-Level Statements & Console Output

In modern C#, you can skip the Program class boilerplate and write statements at the top level.

  • Console.WriteLine prints a line.
  • using System; brings in Console.
  • Top-level statements compile into a Main method for you.
using System;

Console.WriteLine("Hello from C# and .NET!");

After you read this chapter, use Write (when available) and Quiz on this page to lock it in — same flow as C, Python, and the other Learn languages.