在.NET 4.0中重大更改重大、NET

2023-09-07 10:51:27 作者:感谢经历

有很多的新功能和类的信息,新的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

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

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.

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

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