Common Language Runtime
The Common Language Runtime simplifies application development, provides a managed execution environment, supports all .Net languages, and simplifies application deployment and management.
The Common Language Runtime (CLR) is where the Microsoft Intermediate Language code is compiled to machine code (or native code) and executed. It is the CLR on the target platform that compiles the code, which allows portability between devices. This concept may become clearer in the following diagram.
Any code you write on your machine, either in Visual Studio or another development tool, is compiled into Microsoft Intermediate Language (MSIL), which is a half way intermediate machine code. It has been compiled, but not into machine code (which is the code run by a processor). This MSIL code is then distributed to any hardware platform that supports the .Net framework, either a web server, Windows 98, Windows 2003 Server, a hand-held device and so on...
When the MSIL code is invoked, it is loaded into the CLR where it is managed by the platform and further compiled to machine code so that it may be run on the processor.
The CLR provides a managed environment where the system performs memory management, security, debugging, type checking, thread support and much more.
In most programming languages it is the responsibility of the programmer to manage memory and resources, however in .Net, the Garbage Collector will automatically clean up the objects once all references to them have been removed. This overcomes the problem of memory leaks, which were a big problem in languages such as C++. The programmer is still responsible for managing database connections and file handles.
Last updated on: Friday 23rd June 2017