.NET Introduction

.NET is not a programming language but is a platform which provide environment to develop the application in any programming language whose language is supported by .NET to developer. .NET support 63 programming language in 63 programming language, out of which 11 languages has been developed by Microsoft and remaining 52 languages developed by other organization.

The components of .NET are,

  • CLR (Common language runtime)
  • CLS (Common language Specification)
  • GC (Garbage Collector)
  • JIT Compiler and

Base class library as in the following,

Component of .Net
                                   Figure: Component of .NET

CLR (Common language Runtime)

Common language runtime is a component of .NET that provide each and every thing which is required to generate the Native code.

CLS (Common language Specification)

As we know that each and every language has there own syntax to write the code, and one language does not support syntax of another language . But .NET support 63 programming language. So there is a common syntax to write the code which will get supported by all 63 programming language.

CTS(Common Type System):

Each and every language has there own data type system, and one language does not support data type of another language. But .NET supports  63 programming language. So there is a common Data type which will get supported by all 63 programming language.

JIT Compiler:

Jit stands for Just in time Compiler which interoperable in CLR .The responsibility of JIT compiler is compile the MSIL Code and generate Native code.There are 3 types of JIT Compiler,

  • Normal Jitter
  • Echono Jitter
  • Pre Jitter

Normal Jitter: Normal jitter compile the selected line of code and it also contains the cache.

Echono Jitter: Echono jitter compile the selected line of code but it does not contains the cache.

Pre Jitter: Pre jitter compile the code from top to button but it does not contain any cache.

Garbage Collector: Garbage Collector is responsible for automatic memory management. As name is garbage collector it collect the object which is not reachable for long time. Memory is divided in 3 Generation as Gen 0, Gen 1,Gen 2 as in the following figure,

Garbage Collector
                           Figure: Generation in Garbage Collector

Newly created object store in Gen 0 and this process will repeat till Gen 0 is full. When Gen 0 will be full then there will be 2 Phases of process. In 1st phase of process it marks the object for reachable and unreachable in the memory. The object which is not reachable means the object has no use for long time and it is an unreachable object. In 2nd phase of process it remove the object which has marked unreachable and transfer the reachable object from Gen 0 to Gen 1 .This same process will follow to transfer the object from Gen 1 to Gen 2 . There are some methods which is used to remove unreachable object from memory.

Dispose method

Dispose() is used to remove the unreachable object from memory or object which has no references. Dispose () is called by Developer.

Finalize method:

Finalize() clean up the object from memory which has no references. Finalize () method get call by System.

Gc.Collect method: gc.Collect () method use to remove the object forcible from memory.

Base class library: This is collection of Class.

Ngen.exe:

Ngen .exe is a tool which is used to compile the MSIL Code and generate Native code. In .NET there is JIT compiler which is used to compile the IL code and generate the native code. But drawback with JIT compiler is the code which has compiled and used once cannot be reuses. So avoiding these drawback we use Ngen.exe which compile the MSIL code and generate native code. The code compiled by ngen.exe get stored in separate file known as image generation file. So this code could be reused when it is required to use.

Code Execution in .Net
                              Figure: Code Execution in .NET

The process of code execution in .NET is source code and get compiled by language compiler and generates MSIL code. MSIL code get compiled by CLR and it generates native code. The execution process is shown in above figure.

Managed Code: The code for which CLR is available after MSIL is known as Managed code.
Unmanaged Code: The code for which CLR is not available after MSIL is known as Unmanaged code.

Recap: .NET is not a programming language but it is a platform which provides the environment to write and run the application.
.NET supports 63 programming languages. The components of .NET are:

  • CLR
  • CLS
  • CTS
  • GC
  • JIT COMPILER and
  • Base class library.

Up Next
    Ebook Download
    View all
    Learn
    View all