17 Oct 2023
Beginner
C# code executes by first being compiled into Common Intermediate Language (CIL) or Intermediate Language (IL) during the build process. When a C# application is run, the Common Language Runtime (CLR) takes over and just-in-time (JIT) compiles the CIL into native machine code specific to the computer's architecture. This machine code is then executed directly by the computer's processor, allowing the C# application to run and perform its intended tasks.
C# Source Code
↓
C# Compiler
↓
Common Intermediate Language (CIL/IL)
↓
Common Language Runtime (CLR)
↓
Just-In-Time (JIT) Compilation to Native Code
↓
Execution by Computer's Processor
In this representation:
- C# source code is compiled by the C# compiler into Common Intermediate Language (CIL) or Intermediate Language (IL).
- The Common Language Runtime (CLR) takes the CIL/IL code and performs just-in-time (JIT) compilation to convert it into native machine code.
- The native machine code is executed directly by the computer's processor, allowing the C# application to run.