Loading
0x00Lesson 1 of 6

Run your first C# program

Meet the .NET runtime and print output from a C# program.

15 min 5-question quiz 1 code exercise
By the end of this lesson you can
  • Recognize a C# entry point and identify the language/runtime versions used.

C# is a statically typed language in the .NET ecosystem. Source code is compiled to intermediate language and executed by the .NET runtime. C# has many versions: this track uses C# 12 on .NET 8.0.402 through Wandbox. C# 12 features include primary constructors and collection expressions, though this beginner track starts with familiar class and method syntax.

Program.cs · C# 12
1using System;
2
3class Program
4{
5    static void Main()
6    {
7        Console.WriteLine("Hello, C# 12!");
8    }
9}
Output
Hello, C# 12!

A .cs file contains C# source. Main is the entry point in this traditional program shape; newer C# also supports top-level statements. Exercises compile and run with .NET 8.0.402 on Wandbox, a free public service. Submitted source and test input are sent there.

Key takeaways

  • C# is compiled and runs on the .NET runtime.

  • This track uses C# 12 and .NET 8.0.402.

  • The service compiles and executes each exercise.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: write C#

Write C# 12 in the editor and run it against sample input. .NET 8 compiles and runs the code through Wandbox, a free public service; your source and test input are sent there.

Exercise 1

Print a greeting

+25 XP

Print exactly Hello, learner! followed by a newline.

  • Greeting
main.c
Loading editor…

C# 12 code is compiled and run with .NET 8 on Wandbox, a free public service. Your source code and test input are sent to that service.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Did you like the lesson? 😆👍
Consider a donation to support our work: