Fundamentals of Computer Programming with C# HTML version

Chapter 1. Introduction to Programming 85
languages share a common system of data types, execution infrastructure
and a unified format of the compiled code (assemblies).
A big advantage of the .NET technology is the ability to run code, which is
written and compiled only once, on different operating systems and
hardware devices. We can compile a C# program in a Windows environment
and then execute it under Windows, Windows Mobile, Windows RT or Linux.
Officially Microsoft only supports the .NET Framework on Windows, Windows
Mobile and Windows Phone, but there are third party vendors that offer .NET
implementation on other operating systems.
Mono (.NET for Linux)
One example of .NET implementation for non-Windows environment is the
open-source project Mono ( It implements the
.NET Framework and most of its accompanying libraries for Linux, FreeBSD,
iPhone and Android. Mono is unofficial .NET implementation and some
features may work not exactly as expected. It does implement well the core
.NET standards (such as C# compiler and CLR) but does not support fully the
latest .NET technologies and framework like WPF and ASP.NET MVC.
Microsoft Intermediate Language (MSIL)
The idea for independence from the environment has been set in the earliest
stages of creation of the .NET platform and is implemented with the help of a
little trick. The output code is not compiled to instructions for a specific
microprocessor and does not use the features of a specific operating system;
it is compiled to the so called Microsoft Intermediate Language (MSIL).
This MSIL is not directly executed by the microprocessor but from a virtual
environment called Common Language Runtime (CLR).
Common Language Runtime (CLR) – the Heart of .NET
In the very center of the .NET platform beats its heart – the Common
Language Runtime (CLR) – the environment that controls the execution of
the managed code (MSIL code). It ensures the execution of .NET programs
on different hardware platforms and operating systems.
CLR is an abstract computing machine (virtual machine). Similarly to
physical computers, it supports a set of instructions, registries, memory
access and input-output operations. CLR ensures a controlled execution of
the .NET programs using the full capabilities of the processor and the
operating system. CLR also carries out the managed access to the memory
and the other resources of the computer, while adhering to the access rules
set when the program is executed.