是否有任何的优势编译用于.NET Framework 3.5,而不是2.0?而不是、有任何、优势、Framework

2023-09-04 07:54:49 作者:イ吔犭艮|叚

有什么好处编制用于.NET Framework 3.5,而不是2.0?

Are there any advantages compiling for .NET Framework 3.5 instead of 2.0?

例如内存消耗少,启动更快,性能更好......

For example less memory consumption, faster startup, better performance...

我个人不这样认为,但是我可能已经错过了一些东西。

Personally I don't think so however, I may have missed something.

编辑:当然有,在3.5框架的更多的功能,但这些都不是这个问题的焦点

Of course there are more features in the 3.5 framework, but these are not the focus of this question.

EDIT2:似乎有没有优势

There seem to be no advantages.

EDIT3:是的我的意思是针对框架。我已经安装了最新的3.5 SP1和VS 2008有啥编译与和定位的框架之间的区别?我可以定位在项目选项的框架,但我怎么'编译'一个特定的框架版本?我不知道这是有区别的。

Yes I meant targeting the Framework. I have installed the latest 3.5 SP1 and VS 2008 so what's the difference between compiling with and targeting a framework? I can target the framework in the project options but how do I 'compile with' a specific framework version? I did not know that there is a difference.

Edit4:所以现在我们都认为没有任何优势。

So for now we agree that there are no advantages.

感谢您的意见

推荐答案

还有编译和目标之间的差异。

There's a difference between compiling and targeting.

编译code与(比如)C#3.0编译器可能会给你的性能提升(非常小家伙反正)一些优化生成的IL code migh已被列入。它也可以让你使用一些像自动属性或λEX pressions的新功能。

Compiling the code with the (for example) C# 3.0 compiler will probably give you a boost on performance (very little one anyway) as some optimization for the generated IL code migh have been included. It also allows you to use some of the new features like automatic properties or lambda expressions.

定位对于一个给定的框架,将确保您的装配工作在该框架(和后验),如果你的目标为2.0,并采用了一块3.5库将失败。没有性能的提升将直接关系到你的,除非从一个框架,另一个最快级替代的类。例如,针对.NET 1.1将不会允许您使用仿制药,因此,你将不得不使用比列表慢得多ArrayList中(由于装箱和拆箱)。

Targeting for a given framework will ensure your assembly works for that framework (and posteriors) and will fail if you target for 2.0 and are using a 3.5 library. No performance improvements will be directly related to that unless your substituting a class from one framework with another "fastest" class. For example, targeting .NET 1.1 won't allow you to use generics and therefore you'll have to use the ArrayList which is considerably slower than List (due to boxing and unboxing).