C# kompileras inte direkt till maskinkod. Det kompileras till IL (Intermediate Language) — en plattformsoberoende bytekod — som CLR kör och använder JIT (Just-In-Time) kompilering för att översätta IL till inbyggd maskinkod vid körning. AOT (Ahead-Of-Time) är ett alternativ som kompilerar till inbyggd kod vid byggtid.
Exekveringspipelinen
C# source (.cs)
│ C# compiler (roslyn)
▼
IL bytecode (in a .dll/.exe assembly) ← platform-INDEPENDENT intermediate code
│ CLR loads it; JIT compiles IL → native code AT RUNTIME (per method, as called)
▼
Native machine code → executes on the CPU
