C# mscorlib 代表什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15061977/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does mscorlib stand for?
提问by Ramón García-Pérez
mscorlib is definitely one of .net base class libraries and every program in C# depends on it, but what does it stand for?
mscorlib 绝对是 .net 基类库之一,C# 中的每个程序都依赖于它,但它代表什么?
In the ECMA standard for the C# Language Specificationthe word is mentioned 4 times and none of them referring to what it means.
在C# 语言规范的 ECMA 标准中,这个词被提及了 4 次,但没有一个是指它的含义。
采纳答案by Mark Cidade
Microsoft Common Object Runtime Library.
中号ICRO小号经常Çommon öbject ř不定时库郭宝宏。
See http://www.danielmoth.com/Blog/mscorlibdll.aspxand What does 'Cor' stand for?
请参阅http://www.danielmoth.com/Blog/mscorlibdll.aspx和“Cor”代表什么?
回答by Bryan
Microsoft Core Library, ie they are at the heart of everything.
Microsoft 核心库,即它们是一切的核心。
There is a more "massaged" explanation you may prefer:
您可能更喜欢更“按摩”的解释:
"When Microsoft first started working on the .NET Framework, MSCorLib.dll was an acronym for Microsoft Common Object Runtime Library. Once ECMA started to standardize the CLR and parts of the FCL, MSCorLib.dll officially became the acronym for Multilanguage Standard Common Object Runtime Library."
“当微软第一次开始开发 .NET Framework 时,MSCorLib.dll 是 Microsoft Common Object Runtime Library 的首字母缩写。一旦 ECMA 开始标准化 CLR 和 FCL 的一部分,MSCorLib.dll 正式成为多语言标准公共对象的首字母缩写运行时库。”
From http://weblogs.asp.net/mreynolds/archive/2004/01/31/65551.aspx
来自http://weblogs.asp.net/mreynolds/archive/2004/01/31/65551.aspx
Around 1999, to my personal memory, .Net was known as "COOL", so I am a little suspicious of this derivation. I never heard it called "COR", which is a silly-sounding name to a native English speaker.
1999 年左右,在我个人的记忆中,.Net 被称为“COOL”,所以我对这个推导有点怀疑。我从来没有听说过它叫做“COR”,对于以英语为母语的人来说,这是一个听起来很傻的名字。
回答by One Man Crew
It stands for
它代表
Microsoft's Common Object Runtime Library
Microsoft 的公共对象运行时库
and it is the primary assembly for the Framework Common Library.
它是框架公共库的主要程序集。
It contains the following namespaces:
它包含以下命名空间:
System
System.Collections
System.Configuration.Assemblies
System.Diagnostics
System.Diagnostics.SymbolStore
System.Globalization
System.IO
System.IO.IsolatedStorage
System.Reflection
System.Reflection.Emit
System.Resources
System.Runtime.CompilerServices
System.Runtime.InteropServices
System.Runtime.InteropServices.Expando
System.Runtime.Remoting
System.Runtime.Remoting.Activation
System.Runtime.Remoting.Channels
System.Runtime.Remoting.Contexts
System.Runtime.Remoting.Lifetime
System.Runtime.Remoting.Messaging
System.Runtime.Remoting.Metadata
System.Runtime.Remoting.Metadata.W3cXsd2001
System.Runtime.Remoting.Proxies
System.Runtime.Remoting.Services
System.Runtime.Serialization
System.Runtime.Serialization.Formatters
System.Runtime.Serialization.Formatters.Binary
System.Security
System.Security.Cryptography
System.Security.Cryptography.X509Certificates
System.Security.Permissions
System.Security.Policy
System.Security.Principal
System.Text
System.Threading
Microsoft.Win32
Interesting info about MSCorlib:
关于 MSCorlib 的有趣信息:
- The .NET 2.0 assembly will reference and use the 2.0 mscorlib.The
.NET 1.1
assembly will reference the1.1 mscorlib
but will use the 2.0 mscorlib at runtime (due to hard-coded version redirects in theruntime itself) - In GAC there is only one version of mscorlib, you dont find 1.1
version on GAC even if you have 1.1 framework installed on your
machine. It would be good if somebody can explain why
MSCorlib 2.0
alone is in GAC whereas 1.x version live inside framework folder - Is it possible to force a different runtime to be loaded by the application by making a config setting in your app / web.config? you won't be able to choose the CLR version by settings in the ConfigurationFile – at that point, a CLR will already be running, and there can only be one per process. Immediately after the CLR is chosen the MSCorlib appropriate for that CLR is loaded.
- .NET 2.0 程序集将引用并使用 2.0 mscorlib。该
.NET 1.1
程序集将引用1.1 mscorlib
但将在运行时使用 2.0 mscorlib(由于运行时本身中的硬编码版本重定向) - 在 GAC 中只有一个版本的 mscorlib,即使您的机器上安装了 1.1 框架,您也不会在 GAC 上找到 1.1 版本。如果有人能解释为什么
MSCorlib 2.0
单独在 GAC 中而 1.x 版本位于框架文件夹中,那就太好了 - 是否可以通过在您的应用程序 / web.config 中进行配置设置来强制应用程序加载不同的运行时?您将无法通过 ConfigurationFile 中的设置来选择 CLR 版本——此时,CLR 已经在运行,并且每个进程只能有一个。选择 CLR 后,立即加载适合该 CLR 的 MSCorlib。