C# Foundations

Lesson 1 of 6

Hello, C#

C# (pronounced "C sharp") is a statically-typed, object-oriented language built by Microsoft for the .NET platform. It's used for everything from web APIs (ASP.NET) to desktop apps to game development (Unity).

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, Kodstigen!");
    }
}

The pieces

  • using System; imports the namespace that contains Console and other common types.
  • Every C# program needs an entry point method called Main, that's where execution starts.
  • Console.WriteLine(...) prints a line of text to the terminal.

Compile and run a C# project with the .NET CLI:

dotnet run

📝 C# Basics Quiz

Passing score: 70%
  1. 1.What is the entry point method of a C# program called?

  2. 2.Console.____("Hello!") prints a line of text to the console.

  3. 3.C# is a statically-typed language.