What Is Common Language Runtime – CLR In NET? CLR is one of the most important components of the .NET Framework.
It supervises the execution of a .NET program by providing various properties and controls in the areas of memory management, security, and exception handling.
Common Language Runtime – CLR In NET?
Therefore, CLR is also called as the execution engine of the .NET Framework. Sometimes CLR is just called as the runtime, where the source code of a .NET application is compiled into a MSIL code.
This MSIL code is translated into the native code with the help of the just-in-time (JIT) compiler, at the time of the execution of the application.
components of Common Language Runtime
CLR provides the following components:
- ClassLoader: Loads the classes of a .NET language in the runtime
- JIT compiler: Specifies a compiler that converts MSIL code into native code
- Code Manager: Manages the resources that are required by a code at the time of execution
- Garbage Collector: Provides automatic memory management and resolves the issue of memory leaks and invalid memory references
- Security Engine: Enforces security restrictions to a .NET code, which is determined by Code Access Security (CAS) at the time of calling of the code by external code
- Type Checker: Performs strict type checking of .NET program.
- Thread execution support: Provides the multithreading support by .NET applications
- Exception Manager: Provides a mechanism to handle the runtime exceptions
- Debugger: Specifies a debug engine that helps you to debug different type of applications
- Base Class Library: Specifies a library that provides data types to .NET applications at runtime
what is CLR In NET?
The CLR manages the execution of the code. Therefore, the code that works on the CLR is called the managed code.
CLR also supports services that the application uses to access various resources, such as collections, arrays, and operating system folders.
CLR In NET
The CLR automatically releases the objects when they are no longer in use. This automatic memory management resolves the issues of memory leaks and Invalid memory references.
The CLR imposes CAS, which is the CLR’s security system that enforces security policies by preventing unauthorized access to protected resources and operations.
CAS also helps in making the code robust, which implies that it makes the code extensible and reusable. It Implements a strict type and code-verification infrastructure called CTS.
microsoft common language runtime
The CLR (CLR In NET) also accelerates the developer’s productivity, as the developer can write the applications in any language, such as C#, Visual Basic, or Visual C++.
They can also take advantage of the runtime, class library, and other components written in the other development languages of the .NET platform.