Master C# from the ground up across seven levels — Getting Started, Fundamentals, Beginner, Intermediate, Advanced, Challenges, and Real World. Each lesson includes runnable code you can experiment with directly in your browser — no installation needed.
14
Lessons
7
Levels
.NET 8
Platform
Free
Cost
Fourteen hands-on lessons across seven levels — from your very first Hello World to async programming and real-world apps. Click any lesson to run the code live.
Before writing code, get your environment ready. Install the .NET SDK and pick the IDE that works best for you.
Visual Studio Code (VS Code) is a free, lightweight, and powerful code editor from Microsoft. It's the most popular editor for C# development outside of full Visual Studio and works on Windows, macOS, and Linux. Steps: 1. Download VS Code from https://code.visualstudio.com and run the installer. 2. Open VS Code and confirm it launches successfully. Recommended settings to configure after installation (File → Preferences → Settings): - Enable 'Format On Save' (editor.formatOnSave: true) to auto-format code every time you save. - Turn on 'Bracket Pair Colorisation' for easier brace matching. Next you will install the C# Dev Kit extension — see S-2 for that step.
// This file verifies that VS Code + C# Dev Kit are working correctly.
// Press F5 (or Run > Start Debugging) to execute.
// You should see a message printed in the integrated terminal.
using System;
class VsCodeSetupCheck
{
static void Main()
{
Console.WriteLine("✓ VS Code is configured correctly!");
Console.WriteLine(" Editor: Visual Studio Code");
Console.WriteLine(" Extension: C# Dev Kit");
Console.WriteLine(" Runtime: " +
System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
Console.WriteLine();
Console.WriteLine("You're ready to start coding in C#.");
}
}The C# Dev Kit is a free, Microsoft-built extension for VS Code that adds everything you need to write, debug, and manage C# projects — including IntelliSense, a Solution Explorer, debugging support, and project templates. Steps: 1. Open VS Code and click the Extensions icon in the Activity Bar (or press Ctrl+Shift+X / Cmd+Shift+X). 2. In the search box type: C# Dev Kit 3. Select the extension published by Microsoft (identifier: ms-dotnettools.csdevkit). 4. Click Install. VS Code will also automatically install the base C# extension as a dependency. 5. Optionally, also install the .NET Install Tool extension (ms-dotnettools.vscode-dotnet-runtime) — it can install the .NET SDK for you if it is not already present on your machine. You can also install it directly from the VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit Once installed, reload VS Code when prompted. You should see a new Solution Explorer panel appear in the Activity Bar, confirming the extension is active.
// After installing C# Dev Kit, open the Command Palette
// (Ctrl+Shift+P / Cmd+Shift+P) and run:
// .NET: New Project
// Choose "Console App", give it a name, and VS Code will
// scaffold the project and open Program.cs for you.
// You can also verify the extension is active by checking that
// IntelliSense suggestions appear as you type below:
using System;
class ExtensionCheck
{
static void Main()
{
// Try typing 'Console.' — IntelliSense should list methods.
Console.WriteLine("C# Dev Kit is installed and working!");
Console.WriteLine("IntelliSense, debugging, and Solution Explorer are ready.");
}
}The .NET SDK is the foundation for every course on this page. It includes the C# compiler, runtime, and command-line tools. It's free, open-source, and works on Windows, macOS, and Linux. Steps: 1. Visit https://dotnet.microsoft.com/download and download the latest .NET SDK (choose the LTS version for stability). 2. Run the installer and follow the on-screen prompts. 3. Open a terminal (Command Prompt, PowerShell, or Terminal) and run: dotnet --version 4. If you see a version number (e.g. 8.0.x) your installation is successful. Once installed, paste the code below into any IDE and run it to confirm everything works.
// Paste this into your IDE and run it to verify your .NET setup.
// You should see version info and a success message printed to the console.
using System;
class VerifySetup
{
static void Main()
{
Console.WriteLine("=== .NET Setup Verification ===");
Console.WriteLine("Runtime: " + System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
Console.WriteLine("OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription);
Console.WriteLine();
Console.WriteLine("✓ Your .NET environment is ready!");
Console.WriteLine("You can now work through any course on this page.");
}
}Once VS Code and the .NET SDK are installed, there are two ways to build and run a C# program: using the integrated terminal or using VS Code's built-in Run & Debug panel. Method 1 — Terminal (recommended for beginners): 1. Open VS Code and create a new folder for your project. 2. Open the integrated terminal (Ctrl+` / Cmd+`). 3. Run: dotnet new console -n MyFirstApp This creates a new console project in a subfolder called MyFirstApp. 4. Navigate into it: cd MyFirstApp 5. Open the generated Program.cs file and replace its contents with your code. 6. Run: dotnet run Your program compiles and executes immediately. Output appears in the terminal. Method 2 — Run & Debug panel: 1. Open the project folder in VS Code (File → Open Folder). 2. Open Program.cs and press F5 (or go to Run → Start Debugging). 3. If prompted to select a debugger, choose C#. 4. VS Code will build the project and launch it in the integrated terminal. Tip: dotnet run builds and runs in one step. For a build-only check without running, use dotnet build. To run without rebuilding, use dotnet run --no-build.
// This is the entry point of a standard .NET console application.
// Run it with: dotnet run (from the terminal inside your project folder)
// Or press F5 inside VS Code with the C# Dev Kit extension installed.
using System;
class BuildAndRun
{
static void Main()
{
Console.WriteLine("Build successful!");
Console.WriteLine("Your C# program is running from VS Code.");
Console.WriteLine();
// dotnet --version prints the SDK version to confirm your toolchain
Console.WriteLine("Useful terminal commands:");
Console.WriteLine(" dotnet new console -n MyApp → create a new project");
Console.WriteLine(" dotnet build → compile without running");
Console.WriteLine(" dotnet run → build and run");
Console.WriteLine(" dotnet run --no-build → run without rebuilding");
}
}Prefer a full IDE experience? Choose the environment that works best for you — all free, no installation required.
The easiest way to run C# in your browser. Paste any code snippet, pick a .NET version, and hit Run — results appear instantly with no sign-up needed.
Open .NET FiddleMicrosoft's official interactive C# experience with guided tutorials, inline execution, and the full .NET SDK running entirely in the browser via WebAssembly.
Open Try .NETA full GitHub-backed CodeSandbox containing modern C# 12 and .NET 8 examples. Browse, edit, and run real project code in a VS Code-style environment.
Open in CodeSandboxRecommended resources to deepen your C# and .NET knowledge beyond the basics.
Microsoft's comprehensive language reference, tutorials, and API docs.
Microsoft Learn →Real-world code samples from the GitHub repo powering the CodeSandbox above.
Browse Repo →Write, run, and share C# snippets instantly. A great way to experiment.
.NET Fiddle →