.Net framework provides a run time environment - CLR. Common language runtime takes the IL code from the compiler( language specific) and provide to code to run time compiler called JIT. So lot of confusion you must be thinking about IL code & Jit ?
IL code is half compile or partially compile code. IL code will be same for all .Net framework languages whether application is developed using C#, VB or any other .Net framework language. .Net provides you this managed environment to write your code and get benefit from this.
In short CLR comes into the picture after .Net compiles the code and convert it into IL code and then CLR takes the responsibility does the operation and provide the code to JIT. JIT are the run time compilers that converts code to machine language.
Benefits of CLR -
1. Garbage Collection - Automatic memory management
2. Thread management
3. Common type system
4. CLS - provides ability to use components developed in different languages
5. Code Access Security (CAS)
5. Exception handling
6. It converts MSIL code to Native code and provides it to Just in time compiler
So now question arises how runtime knows about the code you write in a file and provides you these benefits so here the magic comes of Metadata.
When you write your code in .net environment and compile the code. .Net creates an assembly and assembly contains metadata. Metadata resides with the code and every loadable PE(executable) contains this metadata.Metadata contains binary information of the code. Every member defined in an assembly/ module metadata contains all this info. When code is executed, Run time loads this metadata into memory and get the reference about the code to do the above mentioned operations.
code that managed in this way called managed code. In simple way if i say the code is taken care by CLR is managed code.
Hope you enjoyed reading this article. Please provide me your feedback if you find it interesting.
IL code is half compile or partially compile code. IL code will be same for all .Net framework languages whether application is developed using C#, VB or any other .Net framework language. .Net provides you this managed environment to write your code and get benefit from this.
In short CLR comes into the picture after .Net compiles the code and convert it into IL code and then CLR takes the responsibility does the operation and provide the code to JIT. JIT are the run time compilers that converts code to machine language.
Benefits of CLR -
1. Garbage Collection - Automatic memory management
2. Thread management
3. Common type system
4. CLS - provides ability to use components developed in different languages
5. Code Access Security (CAS)
5. Exception handling
6. It converts MSIL code to Native code and provides it to Just in time compiler
So now question arises how runtime knows about the code you write in a file and provides you these benefits so here the magic comes of Metadata.
When you write your code in .net environment and compile the code. .Net creates an assembly and assembly contains metadata. Metadata resides with the code and every loadable PE(executable) contains this metadata.Metadata contains binary information of the code. Every member defined in an assembly/ module metadata contains all this info. When code is executed, Run time loads this metadata into memory and get the reference about the code to do the above mentioned operations.
code that managed in this way called managed code. In simple way if i say the code is taken care by CLR is managed code.
Hope you enjoyed reading this article. Please provide me your feedback if you find it interesting.