在.NET 4.0中重大更改 [英] Breaking changes in .NET 4.0

查看:104
本文介绍了在.NET 4.0中重大更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多的新功能和类的信息,新的4.0然而,也有可能会影响现有应用程序的变化,例如:

There is a lot of information about new features and classes in new 4.0 however there are also changes that may affect existing applications, for example

  1. 时间跨度现在实现IFormattable老的的String.Format()的无效选项将引发调用简单的ToString的异常,而不是()。但是,CLR的团队提供了一个很好的功能,以从previous版本的行为与配置设置 - TimeSpan_LegacyFormatMode

  1. Timespan now implements IFormattable and old string.Format() with invalid options will throw exception instead of calling simple ToString(). However, CLR team provides a nice feature to enable behaviour from previous version with configuration setting - TimeSpan_LegacyFormatMode .

CLR内而外

访问到他们正在使用+ =或声明的类中的事件 - =将导致调用添加/删除生成的访问返回void。有些code甚至不会编译4.0。

Access to events inside the class where they are declared using += or -= will lead to call add/remove generated accessors that return void. Some code won't even compile in 4.0.

<一个href="http://blogs.msdn.com/cburrows/archive/2010/03/18/events-get-a-little-overhaul-in-c-4-part-iii-breaking-changes.aspx">Chris伯罗斯博客

CAS是德precated并使其人们仍然需要在配置中使用特殊的设置 - NetFx40_LegacySecurityPolicy

CAS is deprecated and to enable it one still need to use special setting in configuration - NetFx40_LegacySecurityPolicy

所以,我不知道什么其他的变化,是有可能找到会或可能会破坏现有的功能与.NET 4.0版本的变化至少preliminary名单?

So I wonder what are other changes and is it possible to find at least preliminary list of changes that will or may break existing functionality with release of .NET 4.0 ?

推荐答案

该语言文档小组发布的C#单独的文件和VB重大更改:

The languages documentation team publishes separate documents for C# and VB breaking changes:

VB:<一href="http://msdn.microsoft.com/en-us/library/cc714070%28VS.100%29.aspx">http://msdn.microsoft.com/en-us/library/cc714070%28VS.100%29.aspx

C#:<一href="http://msdn.microsoft.com/en-us/library/ee855831%28VS.100%29.aspx">http://msdn.microsoft.com/en-us/library/ee855831%28VS.100%29.aspx

我写的C#之一,包括克里斯·伯罗斯讨论了埃里克利珀提到的协变和逆变重大更改,和事件的变化。也有各地的可选参数,嵌入的互操作类型和方法组类型推断一些重大的变化。

I wrote the C# one and included covariance and contravariance breaking changes mentioned by Eric Lippert, and events changes discussed by Chris Burrows. There are also some breaking changes around optional parameters, embedded interop types, and method group type inference.

更新:

还有一个有用的文件(从.NET文档队):<一href="http://msdn.microsoft.com/en-us/library/ee941656%28VS.100%29.aspx">http://msdn.microsoft.com/en-us/library/ee941656%28VS.100%29.aspx

One more useful document (from .NET documentation team): http://msdn.microsoft.com/en-us/library/ee941656%28VS.100%29.aspx

这篇关于在.NET 4.0中重大更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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