Basics of .NET Programs and Memory Management

.NET has made a lot of improvements in its core to enhance the performance of an application. It is the first solid-core environment that really connects to all parts of the technology for developers. Inorder to make solid footsteps in the .NET environment, it would be great to know about the basic advantages and also the architecture of the .NET environment that you are going to start working on.

The most important infrastructural component of the .NET framework is Common Language Runtime (CLR). The code that you write inside the framework is called the managed code, which benefits from cross-language integration, cross-language exception handling, enhanced security,  versioning, and easy deployment support. Every component in a managed environment conveys some specific rule sets. When you write your code in a managed environment, the code gets compiled into the common intermediate language (CIL).
This language remains constant or equivalent to a code that might be compiled from another language. The commonality of languages is maintained in a managed environment by the use of an intermediate language. The languages that are built on top of CIL follows rules defined on the Common Language Specification (CLS). The Diagram below demonstrate the fact :

In the diagram, the source code from any .NET language is converted to CIL code with help from the respective supported compilers. To compile a C# source code, we have CSC compiler and similarly we have a VBC compiler for VB .NET code. The CIL is then again converted to native code using the JIT compiler. The JIT (just-in-time) compiler converts the intermediate language to a machine-dependent code when it is executed during runtime.

Thus, you can copy an assembly to any platform that has the runtime installed and the assembly will work in the same way. The introduction of a multicore JIT implementation with CLR makes applications run almost at the same pace as running native code.
The CLR is supported by Common Type System (CTS). When you consider the languages in .NET, each of them is backed up with a wide set of libraries available in every language. This library is a set of assemblies installed when the .NET framework is loaded in a system, and when it forms a major portion of any program, we built on top of it. Even though the framework allows you to write code in different languages, the internal type system remains constant for every language.

For example, Integer of VB .NET is mapped to the same type in CLR as to int of C#. Both of them point to the System.Int32 type in a framework.

The language that exists in the .NET environment is built on top of CLR such that the compiler that compiles the source code should produce the CIL which follows the ECMA standardization specified. There are a number of languages that are not built by Microsoft and are not shipped with the .NET framework which include Lsharp, Boo, A Sharp, Fantom, and so on, which are built on top of the .NET framework and which follows the ECMA standards. The internal bits of an assembly built by these language compilers are exactly same and can be identified by the JIT compiler easily.

NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

Popular posts from this blog

Example to disable save as certain file type in SSRS Report Viewer

Phone book application example - Java

Modal Popup Message Box ASP.NEt C# Example