Common Language Runtime (CLR) in C# (original) (raw)

Last Updated : 31 Jan, 2025

The **Common Language Runtime (CLR) is a component of the Microsoft .NET Framework that manages the execution of .NET applications. It is responsible for loading and executing the code written in various .NET programming languages, including C#, VB.NET, F#, and others.

When a C# program is compiled, the resulting executable code is in an intermediate language called Common Intermediate Language (CIL) or Microsoft Intermediate Language (MSIL). This code is not machine-specific, and it can run on any platform that has the CLR installed. When the CIL code is executed, the CLR compiles it into machine code that can be executed by the processor.

Working of CLR

**1. Compilation and Execution:

**2. Services Provided by CLR:

**3. Cross-Language Integration:

CLR allows code from different .NET languages (C#, VB.NET, F#) to work together seamlessly through the Common Type System (CTS).

Key Components of CLR

As the word specify, Common means CLR provides a common runtime or execution environment as there are more than 60 .NET programming languages.

Below table illustrate the CLR version in .NET framework.

CLR Versions .NET Framework Versions
1.0 1.0
1.1 1.1
2.0 2.0
2.0 3.0
2.0 3.5
4 4
4 4.5 (also 4.5.1 & 4.5.2)
4 4.6 (also 4.6.1 & 4.6.2)
4 4.7 (also 4.7.1 & 4.7.2)
4 4.8 (also 4.8.1)
- 6
- 8.0
- 9.0

Below diagram illustrate how CLR is associated with the operating system/hardware along with the class libraries. Here, the runtime is actually CLR.

Role of CLR in the Execution of a C# Program

Benefits of CLR