.NET › CLR & Runtime
What is CIL (Common Intermediate Language), and what role does it play between source code and execution?
BeginnerAnswer
CIL is the CPU-independent, low-level instruction set that every .NET compiler (csc for C#, the F# compiler, etc.) produces instead of native machine code -- this intermediate step is what enables both cross-platform execution (the CLR's JIT compiler translates CIL to whatever machine code the current OS/CPU needs) and language interoperability (a C# class and an F# class both compile down to the same CIL representation, so they can call each other directly without any bridging layer).
// You can inspect a compiled assembly's CIL using a tool like ildasm or dotnet-ildasm
// A simple method like this:
public int Add(int a, int b) => a + b;
// compiles to CIL roughly resembling:
// ldarg.1
// ldarg.2
// add
// retReal-world example A library written in F# exposing a public class is consumed directly from a C# project with zero special glue code, only possible because both languages' compilers target the identical CIL format that the CLR understands.