Roadmap › 1. .NET › Step 7
C#

C# Language — Basics to Advanced

Types, control flow, collections, generics, delegates, async/await, memory and modern C# features up to C# 14.
What it is & where it is used

C# (pronounced "C sharp") is a modern, object-oriented, type-safe language created by Microsoft (lead designer Anders Hejlsberg) and standardised as ECMA-334. It compiles to IL (Intermediate Language) which the .NET runtime (CLR) turns into machine code with a JIT (or ahead of time with Native AOT).

Where C# is used:

  • Web APIs and web apps — ASP.NET Core (MVC, Razor Pages, Web API, Blazor)
  • Desktop — WPF, WinForms, .NET MAUI, WinUI
  • Cloud and microservices — Azure Functions, containers, gRPC
  • Games — Unity
  • Data, ETL and background workers — Worker Services, console apps

Why interviewers care: almost every .NET round starts with C# fundamentals (value vs reference types, OOP, collections, LINQ, async) before moving to frameworks.

Versions & history
C#Year.NET / Visual StudioHeadline features
1.02002.NET Framework 1.0, VS.NET 2002Classes, structs, interfaces, events, properties, delegates
2.02005.NET Framework 2.0, VS 2005Generics, nullable value types, iterators (yield), anonymous methods, partial types
3.02007.NET Framework 3.5, VS 2008LINQ, lambda expressions, var, extension methods, anonymous types, auto-properties, object/collection initialisers
4.02010.NET Framework 4.0, VS 2010dynamic, named and optional parameters, generic co/contravariance
5.02012.NET Framework 4.5, VS 2012async / await, caller-info attributes
6.02015VS 2015 (Roslyn compiler)String interpolation, nameof, ?. null-conditional, expression-bodied members, exception filters
7.0–7.32017–2018VS 2017Tuples, pattern matching, out var, local functions, ref returns, in parameters, Span<T> support
8.02019.NET Core 3.0Nullable reference types, switch expressions, async streams, ranges ^1/.., default interface methods, using declarations
9.02020.NET 5Records, init setters, top-level statements, target-typed new(), relational/logical patterns
102021.NET 6 (LTS)Global usings, file-scoped namespaces, record structs
112022.NET 7Raw string literals, required members, list patterns, generic math (static abstract interface members)
122023.NET 8 (LTS)Primary constructors for classes, collection expressions [1, 2], alias any type
132024.NET 9params collections, System.Threading.Lock, partial properties
142025.NET 10 (LTS)Extension members (extension blocks), the field keyword, null-conditional assignment a?.B = x

Interview tip: you don't need every row. Know the big ones: generics (2.0), LINQ (3.0), async/await (5.0), nullable reference types (8.0), records (9.0), and the version you use at work.

Lifecycle

How a C# program runs

  1. Write .cs files inside a project (.csproj).
  2. Build — the Roslyn compiler turns C# into IL plus metadata, packaged in an assembly (.dll/.exe).
  3. Load — the CLR loads the assembly, verifies the IL and resolves dependencies.
  4. JIT compile — each method is compiled to native code the first time it is called (tiered compilation re-optimises hot methods). Native AOT compiles everything ahead of time instead.
  5. Execute — managed code runs with type safety, exception handling and the garbage collector managing the heap.
  6. Unload / exit — finalisers and IDisposable cleanup run; the process ends.

Object lifecycle: new → constructor runs → object lives on the managed heap while referenced → becomes unreachable → collected by the GC (Gen 0 → 1 → 2) → finaliser (if any) runs. Deterministic cleanup of unmanaged resources is done with Dispose() / using.

Tools used to develop
ToolUse
Visual Studio 2022/2026 (Windows)Full IDE: debugger, profiler, designers, test explorer
Visual Studio Code + C# Dev KitLightweight cross-platform editor
JetBrains RiderCross-platform IDE with strong refactoring
.NET SDK / dotnet CLIdotnet new, build, run, test, publish
NuGetPackage manager (dotnet add package)
LINQPadQuick C#/LINQ scratchpad, great for interview practice
xUnit / NUnit / MSTestUnit testing frameworks
BenchmarkDotNetMicro-benchmarks
dotnet-trace, dotnet-counters, dotnet-dumpDiagnostics in production
ILSpy / SharpLabSee the IL and lowered C# the compiler produces