Why Base Class Library in .NET?
I am bit confused about the way C# program get executed. What I learnt till now is,
- 开发者_StackOverflow社区C# program + Base Class library forms a Source code
- This source code is given to C# compiler to get converted into MSILIL code.
- This MSIL code is handed over to .NET Framework to converted into native code.
So my question is why do we need Base Classes in .NET Framework, as the required Base Classes are already converted to MSIL code?
Am I getting the above process wrong? Please help! I googled it but not able to clear the dought. Thanks for your kind Attention!
The base class library isn't part of the source code. It's something your source code refers to, but the C# compiler doesn't recompile it.
You got it a bit wrong:
- The C# code forms the source code
- That source code is compiled to CIL by a C# compiler and packaged in an assembly
- At runtime, your assembly (and any assembly it refers to) is loaded by the CLR
- The CLR has a JIT compiler that generates machine code from that CIL
- The resulting machine code is then executed
C# program + Base Class library forms a Source code then we compile source code by using respective compiler. that time:-
Whenever we compile our code written in any .net language the associated compiler (like C#,VB Compiler) generates binaries called assembly (it may be .dll or .exe) which contains MSIL code or CIL code. These Instructions are low level human readable language and later on can be converted into machine language by run time compiler (JIT, it is part of CLR) during its first execution.It is done just during execution so that the compiler will have before hand knowledge of which environment it’s going to run so that it can emit the optimized machine language code targeting that platform. The .net Framework’s such compiler is called Just-in-Time (JIT) compiler or Jitter.
And compiler doesn't re-compile the dll or base class library, those are refereed by your source code.
Base class libraries provide the lots of functionality to reach near to target, that's we use them.
精彩评论