What happens from C# source code to program execution?
Quick Interview Answer
Detailed Explanation
The C# compiler first analyzes source code for syntax, type correctness, and language rules. It then normally emits Intermediate Language and metadata into a .NET assembly.
When the application starts, the .NET runtime loads the required assemblies and types. During execution, the JIT compiler normally converts required IL methods into native machine code, unless an ahead-of-time strategy has already produced native code.
The runtime also provides services such as garbage collection, exception handling, type safety, thread management, and interoperability.
Understanding this pipeline helps explain concepts such as assemblies, IL, metadata, reflection, JIT, AOT, garbage collection, and runtime behavior that frequently appear in senior C# interviews.