What is IL Code, CLR, CTS, CLS & JIT?






4.42/5 (29 votes)
What is IL code, CLR, CTS, CLS & JIT
IL/MSIL/CIL - IL code is a CPU independent partially compiled code. It’s partially compiled because we do not know in what kind of environment .NET code will run and on runtime IL Code will compile to machine code using the environmental properties (CPU, OS, machine configuration, etc).
ILDASM - This is a tool provided by Visual Studio to view IL code. To run ILDASM, we have to select option “Visual Studio Command Prompt” from “Visual Studio Tools” and type ildasm. It will open the ildasm tool where we can open any exe/dll.ildasm tool read the assembly by reflection and it is showing us various properties, methods which our assembly has. Here, we can see IL code of any method/property by clicking on that.
CLR - CLR is the heart of the .NET framework and it does 4 primary important things:
- Garbage collection
- CAS (Code Access Security)
- CV (Code Verification)
- IL to Native translation
CTS - CTS ensures that data types defined in two different languages get compiled to a common data type. This is useful because there may be situations when we want code in one language to be called in other language.
We can see a practical demonstration of CTS by creating the same application in C# and VB.NET and then compare the IL code of both applications. Here, the datatype of both IL code is same.
CLS - CLS is a subset of CTS. CLS is a set of rules or guidelines. When any programming language adheres to these set of rules, it can be consumed by any .NET language.CTS.
JIT - JIT compiles the IL code to Machine code just before execution and then saves this transaction in memory.