开发者

Why Base Class Library in .NET?

开发者 https://www.devze.com 2023-03-23 09:05 出处:网络
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

I am bit confused about the way C# program get executed. What I learnt till now is,

  1. 开发者_StackOverflow社区C# program + Base Class library forms a Source code
  2. This source code is given to C# compiler to get converted into MSILIL code.
  3. 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:

  1. The C# code forms the source code
  2. That source code is compiled to CIL by a C# compiler and packaged in an assembly
  3. At runtime, your assembly (and any assembly it refers to) is loaded by the CLR
  4. The CLR has a JIT compiler that generates machine code from that CIL
  5. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消