.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
Timespan 现在实现 IFormattable 和旧的 string.Format() 带有无效选项将抛出异常而不是调用简单的 ToString().但是,CLR 团队提供了一个很好的功能,可以通过配置设置启用先前版本的行为 - TimeSpan_LegacyFormatMode .
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 .
访问使用 += 或 -= 声明事件的类内的事件将导致调用返回 void 的添加/删除生成的访问器.有些代码甚至无法在 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.
CAS 已弃用,要启用它仍需要在配置中使用特殊设置 - NetFx40_LegacySecurityPolicy
CAS is deprecated and to enable it one still need to use special setting in configuration - NetFx40_LegacySecurityPolicy
所以我想知道还有哪些其他更改,是否可以找到至少会或可能会破坏 .NET 4.0 发布的现有功能的更改的初步列表?
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:http://msdn.microsoft.com/en-us/library/cc714070%28VS.100%29.aspx
C#:http://msdn.microsoft.com/en-us/library/ee855831%28VS.100%29.aspx
我编写了 C#,其中包括 Eric Lippert 提到的协变和逆变破坏性更改,以及 Chris Burrows 讨论的事件更改.还有一些围绕可选参数、嵌入式互操作类型和方法组类型推断的重大更改.
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 文档团队):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