.Net : How Compilation Of Code Works
Compilation Of Code In .Net
Source code is compiled in Intermediate Language (IL) by their own language compiler. See the Figure below and proceed step by step.
Suppose a developer choose to write a code in any language let's say we are taking two language code C# and VB. Now the code is compiled by its language compiler into Intermediate Language Code (IL). It means every .Net language has its own language compiler so that it may compiled into IL. Now the question is what is this IL Code? Why we inserted or using this in our figure. IL is half (1/2) compiled code and is same for every language. IL is the lowest-level human readable programming language used by the .NET Framework. For ex- Take Vb Code (in column 1) and C# Code (in column 2)
both returning the same output but the syntax is different as you can see in Figure 3. Means Data-types are different there declaration is different there casting styles is different. We are using a different syntax for Vb.Net Code and completely different syntax for C# Code. But, now what happen is VSC will compile the Vb.Net code into IL and similarly the CSC will compile the C# code into IL. Now, when you look into the IL Code, it will be same for both the source code. That means there is no two different source code. We have only one single source code, which is IL. This is How the compilation is done from source code to Intermediate Language (IL) code. Next we read about IL.