.NET is the platform; the CLR is the runtime that executes managed code. Understanding IL, assemblies, and JIT helps you read stack traces and reason about performance—similar in role to the JVM in Java.
Compilation pipeline
- C# compiler (
Roslyn) emits IL (Intermediate Language) in assemblies (.dll/.exe) - CLR loads assemblies and JIT-compiles hot methods to native CPU instructions
- Garbage collector reclaims unreachable objects on the managed heap
Assemblies and the BCL
An assembly is a deployment unit containing IL and metadata. The Base Class Library provides System.* types—Console, collections, LINQ, IO, and more. Web hosts and EF ship as separate packages in ASP.NET.
Important interview questions and answers
- Q: What is IL?
A: CPU-neutral bytecode the CLR JIT-compiles—like JVM bytecode but for .NET. - Q: Managed vs unmanaged code?
A: Managed code runs under CLR with GC; unmanaged code (C APIs, raw pointers) needs explicit lifetime discipline.
Self-check
- What does JIT stand for in this context?
- What file extension do .NET assemblies often use?
Tip: Remember the pipeline: C# → IL → CLR JIT → native. Stack traces often mention IL offsets before JIT inlining.
Interview prep
- What is IL?
Intermediate Language—CPU-neutral bytecode in assemblies that the CLR JIT-compiles to native machine code at runtime.
- Managed vs unmanaged code?
Managed code runs under the CLR with GC; unmanaged code (P/Invoke, raw pointers) requires explicit lifetime discipline.