Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

How C# Works · Lesson 8 of 27

Common Language Runtime (CLR)

A free lesson from Swipe Coding · C#, level 1 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
CIL needs someone to actually run it — say hello to the CLR. 👋

You have learned that the compiler produces CIL (packaged inside an assembly) from your source code. But who actually executes this CIL? The answer: the "Common Language Runtime", or CLR for short.

The CLR is a program that runs on your operating system and reads CIL. Using a technique called "Just-In-Time" (JIT) compilation, it translates the CIL into the machine language that your specific device's processor understands — right as the program runs, whether that's a Windows PC, a Mac, or a Linux server.

dotnet run
This is how you start a program on the command line: the "dotnet" tool hands your compiled assembly to the CLR, which JIT-compiles and runs it.
Fill in the blank

The CLR uses ____-In-Time compilation to translate CIL into machine language as the program runs.

🤖
The CLR does more than just translate — it looks after your program too. 🛡️

Beyond translating CIL, the CLR also manages important background tasks for your program: it automatically frees up memory that is no longer needed (a process called "garbage collection"), enforces C#'s strong typing rules, and handles errors that occur while the program is running.

True or false

The CLR automatically manages memory for a running C# program through garbage collection.

🤖
Watch how these three pieces line up into one complete pipeline. 🔗

The complete process looks like this: you write Program.cs (source code). The Roslyn compiler translates it into an assembly containing CIL. The CLR reads that assembly and executes it, JIT-compiling the CIL into machine code for your device along the way.

Quick check

What is the main job of the Common Language Runtime (CLR)?

Keep your streak going in Swipe Coding

Swipe through every level of C# on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →