简体   繁体   中英

Are there any advantages using a .NET Framework 4.0 dll instead of a 2.0 dll?

In a similar topic of this question I'm wondering whether there are any advantages for using a dll that is specifically compiled for .NET 4.

For example: log4net and nunit only officially release libraries that are compiled for .NET 2.0 but these work fine in a .NET 4.0 application. Is there an advantage of taking these libraries and re-compiling them for .NET 4.0?

Obviously the new features in the framework can be targetted by using the newer runtimes, but I'm talking about just straight re-compiling.

If you recompile them using the C# 4 compiler, you will get various improvements in IL generation, including field-like events and better lock statements .

You'll get some of these improvements even if you target .Net 2.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM