c# – 调用.NET 2 DLL的.NET 4应用程序是否有任何性能影响?

前端之家收集整理的这篇文章主要介绍了c# – 调用.NET 2 DLL的.NET 4应用程序是否有任何性能影响?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我找不到这个确切问题的答案,但有相关问题.

我们有编译为使用.NET 4的BIG WinForms应用程序.但是,我们调用的几个DLL和所有第三方控件都被编译为使用.NET 2.显然这有效,但是因为这有任何负面的性能问题场景,如果一切都使用.NET 4,它会更快.

我不是在尝试进行微优化,但如果我能通过重新编译我拥有的源代码来获得微小/小的提升,那么我愿意付出努力,如果有收获的话.

解决方法

从理论上讲,不应对绩效产生任何重大影响.

The compatibility goal for the .Net Framework is that applications and components from prevIoUs versions should work smoothly on the .Net Framework 4…

当.NET 4.0应用程序加载.NET 2.0程序集时,它将使用兼容模式功能加载到4.0运行时,该功能有助于防止破坏:

In-Proc SxS does not solve the compatibility problems faced by library developers. Any libraries directly loaded by an application–either via a direct reference or an Assembly.Load–will continue to load directly into the runtime and AppDomain of the application loading it. This means that if an application is recompiled to run against the .NET Framework 4 runtime and still has dependent assemblies built against .NET 2.0,those dependents will load on the .NET 4 runtime as well. Therefore,we still recommend testing your libraries against all version[s] of the framework you wish to support. This is one of the reasons we have continued to maintain our high level of backward compatibility.

猜你在找的C#相关文章