Back to course

Your First Program: Hello World

C# Zero to Hero: Comprehensive Programming Masterclass

Hello World in C#

Let's create your first application.

Create a Project

  1. Open Visual Studio.
  2. Click 'Create a new project'.
  3. Select Console App.
  4. Name it HelloWorld.

The Code

csharp using System;

namespace HelloWorld { class Program { static void Main(string[] args) { Console.WriteLine("Hello, World!"); } } }

Breakdown

  • using System;: Allows us to use classes from the System namespace (like Console).
  • static void Main: The entry point where the program starts.
  • Console.WriteLine: Prints text to the screen.