C# 2.0、3.0 和 4.0 中的新功能列表 [英] List of new features in C# 2.0, 3.0 and 4.0

查看:17
本文介绍了C# 2.0、3.0 和 4.0 中的新功能列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 .NET 1.1 项目上工作了很长时间,我被困在 C# 1.0 上,现在我想赶上最新最好的.

I worked on the .NET 1.1 project for a long time, and I was stuck at C# 1.0 and now I would like to catch up with the latest and greatest.

Google 返回了大量有关 C# v2.0 中新功能的信息,但对于版本 3 和 4,我只找到了部分信息.

Google returned a lot of information on new features in C# v2.0, but for the versions 3 and 4 I found only partial information.

互联网上是否有一些 C# 在 v2.0、v3.0 和 v4.0 中引入的所有新特性的列表?

Is there somewhere on the Internet some list of all new features introduced in C# in v2.0, v3.0 and v4.0?

推荐答案

我自己的书的完整插件,但希望不是免费的:获取 深入了解 C# 第二版.它跳过了 C# 1,但详细介绍了 C# 2、3 和 4 的每个特性.

Complete plug for my own book, but hopefully not gratuitous: get hold of the early access version of the second edition of C# in Depth. It skips C# 1, but goes into detail on every feature of C# 2, 3 and 4.

如果你只是想要一个特性列表,来自附录 C:

If you just want a list of features though, from appendix C:

C# 2.0:

C# 2 的主要特性是泛型、可为空类型、匿名方法和其他与委托相关的增强和迭代器块.此外,还引入了几个较小的特性:部分类型、静态类、具有不同 getter 和 setter 访问修饰符的属性、命名空间别名、pragma 指令和固定大小的缓冲区.

The major features of C# 2 were generics, nullable types, anonymous methods and other delegate-related enhancements and iterator blocks. Additionally, several smaller features were introduced: partial types, static classes, properties with different access modifiers for getters and setters, namespace aliases, pragma directives and fixed-sized buffers.

C# 3.0:

C# 3 主要针对 LINQ 构建,尽管许多功能在其他地方也很有用.自动属性、数组和局部变量的隐式类型、对象和集合初始值设定项和匿名类型都包含在 XREF ch8 章节中.Lambda 表达式和表达式树扩展了在 2.0 版中取得了与委托相关的进展,扩展方法为查询表达式提供了最后一个要素.分部方法仅在 C# 3 中添加,尽管分部类型本身在 C# 2 中.正如 Marc 在评论中指出的那样,泛型类型推断在 C# 3 中得到了相当大的提升.

C# 3 primarily built towards LINQ, although many features are useful elsewhere. Automatic properties, implicit typing of arrays and local variables, object and collection initializers and anonymous types are all covered in chapter XREF ch8 . Lambda expressions and expression trees extended the delegate-related progress made in version 2.0, and extension methods provided the last ingredient for query expressions. Partial methods were only added in C# 3, although partial types themselves were in C# 2. As Marc points out in the comments, generic type inference received a considerable boost in C# 3.

C# 4.0:

C# 4.0 有一些旨在实现互操作性的特性,但没有相同的特性C# 3.0 的一心一意.再次有一个相当清晰的鸿沟小"功能(命名参数,可选参数、更好的 COM 互操作性、通用差异)和动态的巨大特性打字.

C# 4.0 has some features aimed at interoperability, but doesn't have the same single-mindedness of C# 3.0. Again there's a reasonably clear divide between the "small" features (named arguments, optional parameters, better COM interop, generic variance) and the huge feature of dynamic typing.

我有一个 C# 2 的bluffers 指南"和另一个C# 3,但恐怕我还没有为 C# 4 做等效的工作.

I've got a "bluffers guide" for C# 2 and another for C# 3, but I haven't done the equivalent for C# 4 yet I'm afraid.

这篇关于C# 2.0、3.0 和 4.0 中的新功能列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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