gpt4 book ai didi

.net - mscorlib.dll 和 System.dll

转载 作者:行者123 更新时间:2023-12-02 02:10:56 25 4
gpt4 key购买 nike

为什么 MS 最初决定维护这两个独立的核心库?也许他们考虑到了一些可扩展性问题,但现在我从未见过任何类型的应用程序不需要两者。有人有这方面的内幕消息吗?这并不重要,但多年来一直在我的脑海里。

PS。我知道这两个库中有什么,我知道区别 - 我是 Reflector 的忠实粉丝:) 只是想知道两者的分离有什么实际用途。

最佳答案

我在 CLR/BCL 团队工作,刚刚回复了您的电子邮件。粘贴如下:

Jared's answer on Stack Overflow is right on. mscorlib.dll is tightly bound to the CLR for the reasons he mentions. Note that mscorlib.dll itself doesn't contain any native code (as Scott suggests), but there are many places where it needs to call directly into the CLR. As such, the CLR and mscorlib must be versioned together.

System.dll on the other hand is not tightly bound to the CLR (it doesn't require any calls into the runtime). We consider System.dll to be at a higher layer than mscorlib.dll. Having these assemblies in two separate layers allows for more flexibility, making it easier to version System.dll separately from the CLR/mscorlib.dll version (if we wanted to do so). We could, in theory, make changes and add functionality to System.dll without revving the CLR/mscorlib version. The separation also makes it easier to manage dependency rules between components in these different layers.

As Scott mentions, it does seem like there's a lot of "optional" stuff in mscorlib. This is mainly for historical reasons and because some things are just needed by other things. For example, there's no technical reason why System.IO.IsolatedStorage needs to be in mscorlib, but that's just where it happened to be added in 1.0, before we really thought about such versioning/layering concerns. Also, List is in mscorlib because other code in mscorlib has a need for a basic list collection.

Long term we'd like to reduce the amount of "optional" stuff in mscorlib as much as possible. Either by pushing stuff out of mscorlib or creating a new, more core, assembly that just contains the bare minimum necessary types (e.g. System.Object, System.Int32, etc.) to make managed code work. This will give us the flexibility to add new innovations to the "optional" stuff, and make it easier to create different .NET Framework SKUs (e.g. the .NET Client Profile, Silverlight, etc.), without having to rev the runtime.

希望这会有所帮助!

谢谢,贾斯汀

关于.net - mscorlib.dll 和 System.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/402582/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com