.NET › CLR & Runtime

What is .NET, and how does it work at a high level?

Beginner

Answer

\.NET is Microsoft's cross-platform development platform for building web, desktop, mobile, cloud, and IoT applications, supporting multiple languages (C#, F#, VB.NET) that all compile down to a shared intermediate format rather than directly to machine code -- at runtime, the Common Language Runtime (CLR) loads that intermediate code and translates it into native machine instructions just before execution, which is what lets the same .NET application run unmodified across Windows, Linux, and macOS.
// Any .NET language compiles to the same intermediate representation
public class Program {
    public static void Main() {
        Console.WriteLine("Hello, .NET");
    }
}
// dotnet build -> produces IL (Intermediate Language) in a .dll
// dotnet run -> the CLR JIT-compiles that IL to native code and executes it
Real-world example A company shipping the same ASP.NET Core API to both a Windows-based internal server and a Linux-based cloud container relies on this exact architecture, since the CLR (not the OS) is responsible for turning the compiled intermediate code into instructions the underlying machine can run.

Common follow-ups: What specifically does the CLR handle beyond just running the code?;How is this different from how a language like C++ compiles and runs?