C#

A modern, typed language from Microsoft for apps, games and web services on .NET.

C# is a statically typed language from Microsoft that runs on the cross-platform .NET runtime. It is used for Unity games, Windows desktop apps, web APIs and business software.

  • Intermediate
  • 13 lessons
Not started yet
Start lesson 1

Lessons

  1. Hello, World!Write and run your first C# program, in both the modern one-line style and the traditional form with a class and a Main method.
  2. Variables & TypesLearn C#'s value types, reference types and nullable types, and how var lets the compiler work out types for you.
  3. Control FlowLearn if/else, loops and switch in C#, including pattern matching in switch expressions.
  4. Methods & PropertiesLearn to write methods and properties. Properties look like fields but run code, so you can control access without writing getX() and setX() methods.
  5. CollectionsLearn the main collection types in System.Collections.Generic, starting with List<T>, the one you will use most.
  6. Classes & OOPLearn classes, inheritance, interfaces and abstract classes in C#.
  7. LINQ & Async/AwaitLearn the basics of LINQ for working with data and async/await for waiting on I/O without blocking.
  8. Mini Project: Simple CalculatorPut the earlier lessons together to build a console calculator that evaluates expressions and keeps a history.
  9. LINQ — Querying AnythingLearn LINQ in more depth. The same filter, project and group methods work on lists, databases, XML and anything else you can loop over.
  10. Generics, Interfaces & DelegatesLearn generics for reusable typed code, interfaces for defining contracts, and delegates for passing functions around as values.
  11. Records, Pattern Matching & Nullable TypesLearn records, pattern matching and nullable reference types, three modern C# features that cut boilerplate and catch null bugs at compile time.
  12. Files, JSON & HTTPLearn to read and write files, convert objects to and from JSON, and call an HTTP API using .NET's built-in tools.
  13. C# CheatsheetModern C# on one page — records, LINQ, async, pattern matching.

Install it on your own computer

C# runs on .NET, which is now cross-platform (Linux, macOS, Windows). Install the .NET SDK and you're ready to go.

Bash
# Download the .NET SDK from dotnet.microsoft.com
# Or via winget:
winget install Microsoft.DotNet.SDK.8

# Verify:
dotnet --version

# Create and run a new project:
dotnet new console -n MyApp
cd MyApp
dotnet run

What people build with C#

Learn the basics first, then pick up these tools when a project needs them.

Practical uses

  • Build .NET web APIs and enterprise systems
  • Create games with Unity
  • Develop Windows and cross-platform apps
  • Run cloud services and automation

Projects to try

  1. Console budget tracker
  2. ASP.NET Core API
  3. Unity puzzle game
  4. Cross-platform Avalonia desktop app

Common tools and packages

ASP.NET CoreEntity Framework CoreUnityNuGetxUnitSerilogMediatRAvalonia

Well-known software

Unity gamesStack OverflowPaint.NETPowerShellKeePassMicrosoft PowerToys