The CLR is the virtual machine component of .NET that manages the execution of programs. It provides services like memory management (Garbage Collection), type safety, and exception handling.
Unlike traditional C++ which compiles to machine code ahead of time, .NET compiles to **Intermediate Language (IL)**. The JIT compiler then translates this IL into machine code at the exact moment it is needed, optimizing it for the specific CPU it is running on.
In .NET Core, DI is not an add-on; it is built into the very core of the system. It allows us to build "Loosely Coupled" systems that are easy to test and maintain.
// Real-world DI Example
public class ProductService : IProductService {
private readonly IRepository _repo;
public ProductService(IRepository repo) {
_repo = repo;
}
// ... logic
}
For a 12-year expert, understanding the 3 Generations of GC (Gen 0, Gen 1, Gen 2) is mandatory. Gen 0 is for short-lived objects (like local variables), while Gen 2 is for long-lived application state. Excessive Gen 2 collections cause "Stop-the-World" pauses that can kill your app's performance.