Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any advantages compiling for .NET Framework 3.5 instead of 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.

Edits

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

  2. There seem to be no advantages.

  3. 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.

  4. So for now we agree that there are no advantages.

like image 866
Roger Ween Avatar asked Sep 15 '08 20:09

Roger Ween


1 Answers

There's a difference between compiling and targeting.

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.

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).

like image 155
Jorge Córdoba Avatar answered Oct 08 '22 08:10

Jorge Córdoba