The .NET Framework is a platform created by Microsoft used for developing different kinds of applications for the Microsoft Windows platform. The .NET Framework can also be used for developing web applications, and even mobile applications. Several versions of the .NET have been released in the past and each iteration adds many features to the previous version. The latest version of .NET is 4.5.2. The .NET Framework contains the .NET Framework Class Library (FCL) which is a gigantic library of classes, structures, enumerations, basic types, and many more which are grouped together into different assemblies. Although .NET Framework applications are designed for Windows and will only run on that platform, newer efforts from Microsoft aimed to bring .NET to other platforms such as Mac and Linux. Microsoft is currently putting an effort to open source .NET (currently a subset of .NET framework called .NET Core).
Common Language Runtime (CLR) is the core of .NET which runs .NET applications. It enables the .NET framework to understand a number of supported languages such as C#, Visual Basic,F#, and C++ more language. This allows you to code your application in any of the supported .NET languages. The code that runs under the CLR and .NET is called manage code because the CLR manage different aspects of your application during runtime.
During compilation, source codes are compiled into Common Intermediate Language (CIL) code. We have to convert our source code into CIL because it is the only language that can be understood by .NET. with example, code in C# and Visual Basic are both compile to CIL. That is why differents .NET application written in different languages as c++,c# and more can still communicate to each other. For example, an application that is written in C# can call the methods of another assembly that is written in Visual Basic.NET. If you want a language to be .NET-compatible, you can create a compiler that compiles your code into CIL.
Once your code is compiled to Common Intermediate Language Associate in Nursingd keep in an assembly like .exe or .dll files, the task is transferred to the Just-In-Time (JIT) compiler. The JIT compiles the CIL code into native code (the language of computers) only that a part of code is required by the program (hence the term “just in time”). The compiled native code is mechanically optimized for the present OS or machine. this can be blessings of mistreatment .NET.
The following summarizes however your C# code is remodeled into a machine feasible program.
- The programmer writes a program in a .NET compatible language such as C#.
- The C# code is compiled into its CIL code equivalent.
- The CIL is stored in an assembly such as an .exe or .dll file.
- When the assembly is executed or called, the JIT compiles the CIL code to native code that the computer can execute.
The .NET Framework also has a feature called the Common Type System (CTS). This is the mapping of the data type specific to a language to its equivalent type in the .NET Framework. Data types are representations of data. For example, whole numbers are represented by the int data type. With CTS, the int data type in C# and the Integer data type in Visual Basic are the same because both are mapped to the .NET type System.Int32.
Garbage collection is another feature of the .NET Framework. When resources are no longer in use, .NET Framework frees up the memory used by an application. The garbage collector is called whenever it is needed by an application although you can call GC manually to clean up resources for you.
Installing .NET Framework
To be able to run a .NET application, you must first install it in your computer. Latest release of Windows 7, 8, 8.1 and 10 operating systems has .NET pre-installed. If your system doesn’t have .NET installed yet, you can download it by clicking the link below / go to microsoft official website:
Microsoft .NET Framework 4.5
After downloading, run the installer and follow the instructions given by the installation wizard. You might need to restart the computer after or during installation. (You can skip this standalone .NET installation for now and wait for Visual Studio installation which will automatically install .NET for you. We will discuss Visual Studio in the next lesson).