gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 20:25:15 26 4
gpt4 key购买 nike

我找不到这个确切问题的答案,但有相关的答案。

我们有编译为使用 .NET 4 的 BIG WinForms 应用程序。但是,我们调用的几个 DLL 和所有第 3 方控件都编译为使用 .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# - 调用 .NET 2 DLL 的 .NET 4 应用程序是否有任何性能影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8145177/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com