简体   繁体   English

.NET执行引擎和BCL(基类库)的合作

[英].NET Execution Engine and BCL (Base Class Library) cooperation

Currently I'm reading a book named C# Pro 7 with .NET and .NET Core written by Andrew Troelsen and Philip Japikse as extra addition to my programming theory. 目前,我正在读一本由Andrew Troelsen和Philip Japikse撰写的名为.NET和.NET Core的C#Pro 7,作为我编程理论的补充。 Topic which on this moment is courious for me is collaboration .NET execution engine (mscoree.dll) with .NET base class libraries like for example mscorlib.dll. 目前让我感到好奇的主题是带有.NET基类库(例如mscorlib.dll)的协作.NET执行引擎(mscoree.dll)。

Can somebody tell me what is the reason why our solution code is interacting with BCL during the compilation to instruction-set platform? 有人可以告诉我,在编译成指令集平台期间,我们的解决方案代码与BCL交互的原因是什么?

  1. That comparasion (BCL and mscorlib.dll) is something kinda extra compatibility checking between our code and base class code used methodology? 这种比较(BCL和mscorlib.dll)是我们的代码与所使用的基类代码之间的一种额外的兼容性检查吗? (Checking the name conventions, return type etc.) (检查名称约定,返回类型等)
  2. Or it just uses construction of the original structure of the class stored in mscrolib.dll and working something similar to the "layout layer" where we can apply our values and then return the output information? 还是只使用了存储在mscrolib.dll中的类的原始结构的构造,并使用类似于“布局层”的方式,我们可以在其中应用我们的值,然后返回输出信息?

"The CLR will also interact with the types contained within the .NET base class libraries when required" what does 'required' part of this sentece exactly mean? “在需要时,CLR还将与.NET基类库中包含的类型进行交互。”此语句的“必需”部分究竟是什么意思? Because once again it's moreover the thing what I would like to understand in correct manner :) 因为这又是我想以正确的方式理解的事情:)

I've just started working through this book. 我刚开始读这本书。 Probably you've already found an answer but for curious others I'll put my two cents. 可能您已经找到了答案,但是对于好奇的人,我将投入两分钱。

In order for the compiled code to be run on a platform it should be compiled to platform-specific instructions. 为了使编译后的代码在平台上运行,应将其编译为特定于平台的指令。 But before that the code should be compiled to MSIL file. 但是在此之前,应将代码编译为MSIL文件。 For the app code this MSIL file is generated every time a change is made and it happens before CLR. 对于应用程序代码,每次进行更改时都会生成此MSIL文件,并且发生在CLR之前。 For BCL there are already assemblies (MSIL files) existing and in CLR they should be only loaded to the memory. 对于BCL,已经存在程序集(MSIL文件),并且在CLR中应仅将它们加载到内存中。 So the runtime engine locates which exact assemblies should be transformed to platform-specific instrcutions and be loaded to the memory. 因此,运行时引擎确定应将哪些确切的程序集转换为特定于平台的指令,然后将其加载到内存中。

So 所以

The CLR will also interact with the types contained within the .NET base class libraries when required 如果需要,CLR还将与.NET基类库中包含的类型进行交互

that means it'll look which types from BCL are referenced in the code. 这意味着它将查看代码中引用了BCL中的哪些类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM