What is the Microsoft .NET Framework?
Brief overview of the microsoft .NET framework and its relationship to the C# programming language
In simple terms, the .NET Framework is a development platform for developing different types of applications. This platform is created by Microsoft. The .NET Framework provides tools and technologies for developing applications for the web, desktop computers and mobile devices.
It is important to keep in mind that the applications developed in C# will run on computers that have the .NET Framework installed on them. This is because the .NET Framework provides the features and services that are needed to run these applications. To understand this concept, let us take a look at the steps of developing a C# program:
- The first step is to write the program. The C# code can be written using a simple text editor. However, there are professional tools available such as Visual Studio 2005 or Visual C# 2005 Express Edition.
- The code written in C# language is called the source code. The computer cannot run the source code directly,it needs to be compiled. Generally, when a source code is compiled, the resultant code is specific to an operating system and hardware. But this is not the case in the .NET Framework. Here, the source code is compiled into Microsoft Intermediate Language (MSIL). This MSIL code is not specific to any operating system or hardware.
- Now, when the code is needed to be executed, such as when the application is run, the Just-In-Time compiler (JIT) converts the code to native code, which is specific for the operating system and the hardware of the computer, on which the application will run. Various JIT compilers are available for specific a operating system and hardware. The .NET Framework will select the appropriate one according to the computer on which the application will run.
At first, it may seem like a complicated process, however it is really very simple because everything is managed by an important component of the .NET Framework, the Common Language Runtime (CLR).
The CLR manages the execution of applications created using C# or any other .NET language. This is why the C# code is referred to as managed code. The CLR looks after the compilation process, manages the memory and security during the application execution and freeing up the memory when the application is no longer in use. Before the .NET Framework, these tasks were being performed by the developer and any error could result into an application crash.
Another major component of the .NET Framework is the Base Class Library (also known as Foundation Class Library). This is a collection of pre-written code for different purposes like database access, web applications, mobile applications, web services etc. Developers can use these pre-written codes in applications directly, depending upon the task required. This simplifies the coding process and saves a lot of development time.
In succeeding chapters, we need to work with different types of data during application development. The type of data is represented using data types. Each programming language has different sets of data types for representing data. For example, C# and Visual Basic uses different data types for using data in applications. The .NET Framework provides a set of basic data types and if the programming languages use them, the code developed in one language can access the code developed in a different language. This set of basic data type is called the Common Type System (CTS).