C# Tutorial - The Common Language Runtime (CLR)


Microsoft's CLR implements the Common Language Infrastructure and therefore is made up of similar components to the CLI:

  • Common Type System (CTS) - This defines the rules for defining data types irrespective of the source language used.

  • Common Language Specification (CLS) - This is a subset of the CTS. It is a set of types that may be used in external calls in code that is intended to be portable.

  • Microsoft Intermediate Language (MSIL) - This is the set of machine instructions defined for use with all .NET languages. The Intermediate code is platform independent, but not automatically type safe, as in C++. Also referred to as managed code and managed data.

  • Metadata - This is information associated with the managed code and data that describes the data, identifies the locations of references to objects, and gives the Virtual Execution System information to handle overhead of older programming models.

  • JIT Compiler - This converts the MSIL into native code of the operating system.

  • Garbage Collector (GC) - This manages the memory when the code is running in the VES. Every so often the GC inspects the memory in use by the computer and removes anything that is no longer needed by the .NET application that is running in the VES. This does not mean that code can be written so that the GC tidies everything up, but instead it should be used as an aid to making applications run smoothly.

  • Virtual Execution System (VES) - This is the part of the system that runs and manages .NET code at runtime in a similar manner to the Java Virtual Machine for the Java Language. The VES sits between the managed code and the native operating system.

At a high level, the CLR is responsible for basic system services such as memory management, threading, error control, and type safety. The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used, through the use of a Garbage Collector.

Components of the CLR

CLR Documents

If you want more information on the CLR, then visit msdn at http://msdn2.microsoft.com/en-us/library/8bs2ecf4(VS.80).aspx.


<< Previous Contents Next >>

© Publicjoe, 2008