The .NET Framework has two main components: the Common Language Runtime (CLR) and the .NET Framework class library.
The CLR helps the execution of a code during runtime. CLR takes care of code management at program execution and provides various beneficial services such as memory management through Garbage Collector, thread management, security management, code verification, compilation, and other system services. The managed code that targets CLR benefits from useful features such as cross-language integration, cross-language exception handling, versioning, enhanced security, deployment support, and debugging.
All .NET applications are compiled into Intermediate Language code (MSIL). When executed on the CLR, MSIL is converted into native machine code specific to the operating platform. This process is done by a Just In Time (JIT) compiler. Managed code is type safe and thoroughly checked by the CLR before being deployed. The .NET runtime also provides a facility to incorporate existing COM components and DLL's into a .NET application. Code that is not controlled by the CLR is called Unmanaged Code.
The Common Type System (CTS) describes how types are declared, used and managed. CTS facilitate cross-language integration, type safety, and high performance code execution.
The Common Language specification (CLS) is a set of specification that defines the rules to support language integration ie rules need to be followed by all libraries and languages. This is done in such a way, that programs written in any language (.NET compliant) can interoperate with one another [ie ensures language interoperability].CLS is a subset of CTS.
Common Type System
Functions of the Common Type System :-
- To establish a framework that helps enable cross-language integration, type safety, and high performance code execution .
- To define rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.
- The CTS also defines the rules that ensures that the data types of objects written in various languages are able to interact with each other.
- It ensures the fact that all the data types require the same amount of memory space in the memory like a variable declared as INT should occupy same memory across all the languages supported by .NET