Skip to content
AgileLogics
5 min read

Your First C# Program

Prerequisites: Installing the .NET SDK

Create and run a new console project:

dotnet new console -o HelloWorld
cd HelloWorld
dotnet run

Program.cs starts out with:

Console.WriteLine("Hello, world!");

Behind the scenes, the compiler still wraps this in a class Program with a static void Main — top-level statements are exactly equivalent, just without the ceremony for a simple program.

Practice

Change the program to print your own name instead of "Hello, world!".

Show solution
Console.WriteLine("Ada");