C#.NET框架的哪些部分是实际语言的部分? [英] Which parts of C# .NET framework are actually parts of the language?

查看:153
本文介绍了C#.NET框架的哪些部分是实际语言的部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道该系统的部分语言功能(核心组件),哪些部分只是有用的填充物,但不是绝对必要的。我可能会关闭这里的措辞,所以让我说明什么我的意思的例子。

I am wondering which parts of the System are language features (core components), and which parts are just useful filler, but aren't strictly necessary. I may be off with the wording here, so let me illustrate with an example what I mean.

考虑 System.Console 类这显然东西是用于什么非常特别的。从本质上说,这件事情有没有发挥好与Windows /当前操作系统的一项功能。这不是我所说的语言的核心组成部分。

Consider System.Console class it's obviously something that is used for something very particular. In essence, this thing is there to play nice with a feature of Windows / current OS. It's not what I would call a core component of the language.

在另一方面,采取 System.IDisposable的接口。这一点显然很重要,因为没有它的使用()语句是没用的。一类需要实现这个特定的界面语言功能在踢。

On the other hand, take the System.IDisposable interface. That thing's obviously very important, as without it the using() statement is useless. A class needs to implement this particular interface for a language feature to kick in.

我可以假设 mscorlib程序是责任方在这里。快速浏览的对象资源管理器显示它的确设有很多我可以同意部件是核心,而在同一时间,它把控制台类为系统命名空间中,这只是填料。

I could assume that the mscorlib is the responsible party here. A quick glance with the Object explorer shows that it indeed houses many of the components I can agree are core, while at the same time it puts the Console class into System namespace, which is just filler.

放置填充物和特定语言的对象到同一个命名空间这个概念等同于他们,但对于C#有更深的了解,我想知道哪个是哪个。所以,我在找的C#核心部件的清单。我假设有一个便利的参考的地方,但因为我的谷歌,上课时睡着了我无法形成正确的查询找到它。

This notion of placing filler and language-specific objects into the same namespace equates them, but for a deeper understanding of C#, I would like to know which is which. So, I'm looking for a list of core components of C#. I'm assuming that there's a handy reference somewhere, but since I was asleep during the google-lecture I was unable to form the correct query to find it.

先谢谢了。

很久以后修改我读的此内容利珀特博客文章,这是一种相关 - 的 - 。有趣的是的foreach 构造实际上并不需要的IEnumerable 接口的功能。

Much later EDIT I read this Lippert blog post, it's kind-of-related. Interestingly foreach construct doesn't actually require IEnumerable interface to function.

推荐答案

有没有的非常的多种类型的用C#实际需要。这是我能想到的把我的头顶部,那些与规范的快速检查:

There aren't very many types actually required by C#. Ones which I can think of off the top of my head and with a quick check of the spec:


  • System.Object的

  • System.Enum

  • System.ValueType

  • 的基本类型:系统{Int16的,的Int32,Int64的,UINT16,UInt32的,UINT64,字节,为SByte人,双人,单人,字符,布尔}

  • System.String

  • System.Decimal

  • System.Nullable< T>

  • 的System.Array

  • System.Exception的(和各种子类 - 见规格的16.4节)

  • System.Delegate(也可能System.MulticastDelegate)

  • System.IDisposable的

  • System.Attribute(和一些特定的属性,如ConditionalAttribute和ObsoleteAttribute)

  • 的System.Type

  • System.Collections.IEnumerable / IEnumerator的

  • System.Collections.Generic.IEnumerable< T> / IEnumerator的< T>

  • System.Collections.Generic.IList< T>

  • System.Threading.Monitor

  • System.Threading.Interlocked

  • System.Linq.Ex pressions.Ex pression< T>

  • 任务和任务< T>对于C#5

  • System.GC的(在规格中提到,但没有明确由编译器使用AFAIK)

现在任何目标框架将需要更多类型比为当然的实施的 - 在评论之类的东西的MethodInfo 如前所述,可能属性来装点出的参数(和一个整体的一堆其他类型的动态类型的)。但是,不同的目标系统可能有不同的实现方式 - 写作真正的便携式C#时,你可以不依赖于它们

Now any target framework is going to require more types than that for the implementation of course - things like MethodInfo as mentioned in comments, probably attributes to decorate out parameters (and a whole bunch of other types for dynamic typing). But different target systems could have different implementations of that - you couldn't depend on them when writing truly portable C#.

这篇关于C#.NET框架的哪些部分是实际语言的部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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