Introduction
Microsoft .NET commonly pronounced as .NET is a platform for developing a managed application. The word "managed" is a key concept. The word "managed" is a key functionality of the .NET Platform.
In the traditional compilation process, the compiler produces an executable binary form that can be run on the operating system immediately. However, in managed .NET, the compiler does not produce executable binary format files, rather it produces files in assembly format (Read the details about that in a later section).
Figure 1
Figure 1 shows a traditional compilation in which we compile the source code and then the compiler produces an executable binary format file.
In .NET the source code is converted into native code or machine code in two phases.
- Phase 1: The compiler of any .NET language converts the source code into Microsoft Intermediate Language (MSIL) commonly known as IL (Intermediate Language) or Byte Code.
- Phase 2: The CLR (Common Language Run-Time Environment) converts this byte code which is an assembly file into machine code. (Read the details of these two phases in a later section).
Figure 2
Figure 2 is a diagram of the compilation process. NET.
".NET supports multiple programming languages i.e. C#, C++, VB, etc. When you compile a program in a .NET environment, the compiler of the corresponding language converts the source code into byte code or IL, which is an assembly file. Then the CLR (Common Language Runtime) converts this byte code into machine code or native ."
Why bother having the extra step of converting source code into machine code?
- The key reasons are portability between operating systems, interoperability between languages, and execution-management features such as memory management and security.
- If the .NET Framework exists for a platform, that platform can run any .NET program. The ability of a program to run without modification across multiple platforms is known as platform independence. Code written once and run everywhere without modification saves our time and money.
See the Interoperability feature of .Net in a later section.
What is CLR?
- CLR does not just convert MSIL into machine code, rather it manages memory, security, and other features relieving the programmers from these responsibilities. Like in C++, you have to manage memory on your own, this leads to complexity and you need extra capabilities for that.
- CLR holds information about the storage of data types and objects.
language Interoperability
- .NET provides a high level of language interoperability. The programs written in different languages are all compiled into byte code and then these different parts are combined to create a single application. For example, in software, one module of the software is written in C#, and another module is written in VB but when they are combined they act as a single application. This feature of .NET distinguishes it from other development environments.
- Any language that can be compiled into byte code or IL is called. NET-compliant language.
- Language interoperability offers many benefits, for example, C#, Visual Basic .NET, and Visual C++ .NET developers, for example, can work side-by-side on the same project without having to learn another programming language—all their code compiles into MSIL and links together to form one program. In addition, the .NET Framework can package old and new components to work together. This allows companies to reuse the code.
Here is a list of some. NET-compliant languages.
- APL Oberon
- C# Oz
- COBOL Pascal
- Component Pascal Perl
- Curriculum Python
- Eiffel RPG
- Fortran Scheme
- Haskell Smalltalk
- Java Standard ML
- JScript Visual Basic .NET
- Mercury Visual C++ .NET
- F#
- IRON PYTHON
- IRON RUBY
- A#
- J#
- NETCOBOL
- P#