So now after you got an overview about the .NET let’s get deeper into its architecture.

The framework consists mainly of a CLR, CLS, CIL, and the BCL, this is only what we are going to need and of course, what we are going to explain.

The CLR:

Let’s start by the CLR or Common Language Runtime, if you are coming from Java so this is the Java VM, otherwise, this is a virtual execution environment for program code and it is the core component of the framework, it handles the JIT compilation, memory management, and the garbage collection including interoperability and a very powerful exception handling.

When you compile your code, it is not compiled directly to machine code, instead it is compiled to a well-know Silencil language called Microsoft Intermediate Language (MSIL), this language is very similar to the Assembly language what made it easier for the JIT than normal C# or VB.NET codes.

Question: So, you say that the .NET does not compile to native language? so how would the CPU understand it?

The answer is quite simple, when you run your program, the CLR calls for the JIT (Just-In-Time) that will compile your MSIL code to native assembly code! This may slow your program a little bit but you can get rid of this by generating a native code using the Ngen tool in the production environment (Will be discuss later), You will get a faster application but you may not! You can just make your application slower because the JIT makes performance optimizations for your code, and also, by using the Ngen tool, you will probably compile some code the current end-user will never use! So the best thing to do is to keep the JIT alive!

The CLS:

The CLS is a set of basic language features to allow all CLI (The CLR in .NET Implementation) Languages to inter-operate with each others. We can say that this is a “set of rules” that a languages should respect to be a valid .NET Language.

The CIL:

You’ve certainly see the MSIL above, what is that? And what does it serve?
The CIl is the lowest-level human-readable programming language defined by the Common Language Infrastructure, and all CLI Languages MSUT compile to it.
MSIL is the Microsoft implementation of the CLI, other framework implementations may name the CLI in an other way, although the runtime engine is described by an ECMA/ISO specification.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *