The Common Language Runtime (CLR) Environment provides a rich set of features for cross-language development and deployment. CLR supports both object-oriented languages and procedural languages. CLR manages the execution of code and provides various services such as security, garbage collection, cross-language exception handling, cross-language inheritance, support for the Base Class Library (BCL), and so on. These are the main constituents of the CLR:
The Common Language Runtime helps you to compile your program code in to an intermediate language called the Microsoft Intermediate Language (MSIL). During runtime this MSIL is converted to the native code and executed. The advantage of the CLR is to compile the code into MSIL which has lots of benefits.
Since all the code is compiled to an MSIL, it is possible to write the code in any language thus giving you the independence to write in any language. MSIL is part of the Portable Executable (PE) file that is created and the other part of the PE contains metadata. This metadata is used to load the classes and it also helps you to load the assemblies dynamically when needed.
The other benefit of using CLR is to enforce security and you can set context boundaries during runtime. Memory handling is done by the CLR which frees the developer from worrying about allocating and de-allocating memory within their program. The lifetime of the objects in the memory are handled through a process called Garbage collection which is unique to the CLR.