.NET Languages & Compilers

 .NET Provides below programing languages

1.     C#

2.     F#

3.     VB

C#

C# (pronounced "C sharp") is a simple, modern, object-oriented, and type-safe programming language.

Its roots in the C family of languages makes C# immediately familiar to C, C++, Java, and JavaScript programmers.

C# having its own compiler which will convert the HLL(High-Level Languages) into MLL(machine level language)

C# syntax

var names= new[]

{

“Hari”,

“Siva”,

“Naresh”,

“Vani”

};

foreach( var name in names)

{

Console.WriteLine($”Hellow {name}”);

}

 

F#

F# (pronounced "F sharp") is a programming language that makes it easy to write succinct, robust, and performant code.

It s having its own compiler which will translates HLL language into MLL.

F# syntax

let names= [“Hari”,”Siva”,”Naresh”,”Vani”]

for name in names do

printfn $”Hellow ${name}”

 

VB

VB is basic syntax programming language and it is an approachable language with a simple syntax for building type-safe, object-oriented apps.

It is having its own compiler which will translate the HLL into MLL

VB syntax

Dim names as List(Of String)({

“Hari”,

“Siva”,

“Naresh”,

“Vani”

}

For Each  name in names

Console.WriteLine($”Hellow {name}”)

Next

 

Compilers

In .NET framework, when you compile your program it didn't immediately create operating system specific native code. Instead, it first compiles your code into Microsoft Intermediate Language (MSIL). Usually all .NET languages such as C#, VB and F# etc are initially compiled into MSIL by CLR compiler.

 

The .Net language such as C#, VB and F#, which is conforms to the Common Language Runtime (CLR), uses its corresponding runtime , which is responsible to run the application on different operating system.

With the help of Just In Time compiler (JIT) the Common Language Runtime (CLR) doing these tasks. JIT converts the MSIL code to native code ,which is CPU-specific code that runs on the same computer architecture.

 

 

Different Type of JIT compilers

·       Normal JIT: Normal JIT Compiler compile the methods at run time and then they are stored in memory cache. This memory cache is commonly referred as "JITTED". Once stored in cache, no further compilation is required for the same method. Subsequent method calls are accessible directly from the memory cache.   



 

·       Ecno JIT: This compiler compile methods when called at runtime and removes them from memory once execution completed.



·       PRe-JIT: This compiler compiles entire assembly into native code instead of used methods.



Advantages

·       The JIT compiler requires less memory usage as only the methods that are required at run-time are compiled into machine code by the JIT Compiler.

·       Code optimization based on statistical analysis can be performed by the JIT compiler while the code is running.

 Disadvantages

·       The JIT compiler requires more startup time while the application is executed initially.

·       The cache memory is heavily used by the JIT compiler to store the source code methods that are required at run-time.

 

CIL/MSIL Code

 The Microsoft intermediate language(MSIL) also goes by the name Common Intermediate Languages(CIL) or We can call it as Intermediate Language (IL).

It is a typically a set of platform instructions  created from source code by languages specific compilers.

Due to MSIL code, .NET Framework achieve language interoperability.

 

.NET Language Interoperability

 Code which is  written in any  .NET Language can be consumed in other .NET Language.This is  called as Language Interoperability. Every .Net Language after Compiling  generates CIL Code which can be used by any other .Net Language i.e within .Net   Each Langauage can perform Operations  with other language with the help of CIL. This feature of.Net is nothing but Interoperability.

 For Example , the CIL code which we get after compiling C# Language can be used by VB Language and the CIL Code which we get after compilation of VB code can be used by C#

 

.NET Run Time

Architecture of .NET Runtime

 


 

 

 

 

 

Comments

Popular posts from this blog

Email Sending through O365 using OAuth Protocol

IoT Technology

What is reverse proxy?