新酷功能的C#4.0功能

由网友(冷瞳°)分享简介:什么是你们正在寻找最酷的新功能,或者说,你听说过被释放在C#4.0。解决方案 动态的东西听起来很酷,如果你需要它的,但我不希望经常使用它的。为代表和接口的通用差异是类似 - 缺少变化是很头疼的时刻,但很多地方是一个痛苦将不包括在C#4中可用的有限变化的地方。在COM功能并不特别关心我 - 我真的应该得到更多的把手上它...

什么是你们正在寻找最酷的新功能,或者说,你听说过被释放在C#4.0。

解决方案

动态的东西听起来很酷,如果你需要它的,但我不希望经常使用它的。

为代表和接口的通用差异是类似 - 缺少变化是很头疼的时刻,但很多地方是一个痛苦将不包括在C#4中可用的有限变化的地方。

在COM功能并不特别关心我 - 我真的应该得到更多的把手上它们是什么,虽然

建立稳定的类型时,可选和命名的参数可以使一个很大的区别:它使语法如下:

 者P =新的Person(名称:夫君,年龄:32);
 

而不必构造函数重载的庞大组合。我想preFER为只读自动实现的属性的形式编写不变类型多一点支持,但我不认为我们会得到这些。 (他们当然不是目前所提出的功能列表中)。

我个人其实更感兴趣的是一对夫妇的框架的的.NET 4.0的特性 - 尤其是 code合同和并行扩展的。

What are the coolest new features that you guys are looking for, or that you've heard are releasing in c# 4.0.

解决方案 Creo4.0新功能之快捷键

The dynamic stuff sounds cool if you need it but I don't expect to use it very often.

The generic variance for delegates and interfaces is similar - the lack of variance is a headache at the moment, but many of the places where it's a pain won't be covered by the limited variance available in C# 4.

The COM features don't particularly interest me - I really ought to get more of a handle on what they are though.

Optional and named parameters could make a big difference when building immutable types: it enables syntax like:

Person p = new Person (name: "Jon", age: 32);

without having mammoth combinations of constructor overloads. I'd prefer a bit more support for writing immutable types in the form of readonly automatically implemented properties, but I don't expect we'll get those. (They certainly aren't in the proposed feature list at the moment.)

I'm personally actually more interested in a couple of the framework features of .NET 4.0 - in particular code contracts and parallel extensions.

阅读全文

相关推荐

最新文章