mscorlib在dotNET中的作用是什么? [英] what is the role of mscorlib in dotNET?

查看:263
本文介绍了mscorlib在dotNET中的作用是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mscorlib在dotNET中的作用是什么?

what is the role of mscorlib in dotNET?? how it is different from other libraries?

推荐答案

本质上,mscorlib与.NET中的其他库没有什么不同.但这是.NET的基础,并且不依赖于任何其他程序集,但是.NET框架中的所有其他程序集都依赖于mscorlib.
In essence mscorlib isn''t different from the other libraries in .NET. But it is the base of .NET and doesn''t depend on any other assembly, but all the other assemblies in the .NET framework depends on mscorlib.


看看 [
Have a look at This[^]

hope it helps :)


我想为Simon的正确答案做出贡献.

不仅其他程序集依赖于mscorlib;还依赖于其他程序集.还有其他一些东西总是使用这个库.特别是,这是C#语言.

您始终可以完全避免显式使用任何库.您可以不使用System名称空间来创建类库.例如,它可以从头开始实现一些纯数字或字符串处理算法,并以公共类/结构和方法的形式导出它们. (为什么只是库?是的,它甚至可以是一个应用程序,但是却毫无用处,因为没有库就无法输出任何内容.)

会使用mscorlib吗?因为您至少需要使用嵌入式类型,例如intuintdoublestring等.是的,所有这些标识符都是该语言的关键字,但是它们分别被实现为System.UInt32System.DoubleSystem.String别名.



感谢Simon提出了所有类型对System.Object的依赖的问题.这个问题不是那么简单.请考虑以下内容:

I want to contribute to a correct answer by Simon.

Not only other assemblies depend on mscorlib; there is something else which always uses this library. In particular, this is C# language.

You can always avoid explicit use of any libraries at all. You can create a class library not using System namespace. For example, it could implement some pure numerical or string manipulation algorithms from scratch and export them in the form of public classes/structures and methods. (Why just the library? Yes, it can be even an application, but quite useless one as it could not output anything without the libraries.)

Will it use mscorlib? It will, because you need to use at least embedded types like int, uint, double, string and the like. Yes, all these identifiers are keywords of the language, but they are implemented as the aliases of System.Int32, System.UInt32, System.Double and System.String, respectively.



Thanks to Simon for bringing the issue of dependency of all the types upon System.Object. This problem is not that simple. Consider the following:

int value = 13; //still, has nothing to do with System.Object. This is a primitive type using exactly 32 bits

System.Console.WriteLine("Value={0}", value); //value is boxed to a type derived from System.Object

//Why? because the signature of WriteLine is
static void WriteLine(string format, params object[] parameters); //accepts System.Object
//so primitive types are subject to boxing



请参阅
http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx [^ ].

—SA



See http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx[^].

—SA


这篇关于mscorlib在dotNET中的作用是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆