简体   繁体   English

.NET 2.0应用程序可以使用.NET 3.5的哪些功能?

[英]What features of .NET 3.5 can be used in a .NET 2.0 application?

I have an app that I am developing in Visual Studio 2008, but the projects are set to .NET 2.0. 我有一个正在Visual Studio 2008中开发的应用程序,但是项目设置为.NET 2.0。 The application will run on a box that only has .NET 2.0 installed. 该应用程序将在仅安装.NET 2.0的盒子上运行。

I understand that I can use some of the features of the .NET 3.5 c# compiler and that it compiles my code to MSIL that .NET 2.0 runtime understands. 我知道我可以使用.NET 3.5 c#编译器的某些功能,并且它将我的代码编译为.NET 2.0运行时可以理解的MSIL。

What are the features of .NET 3.5 that I can use in my .NET 2.0 app? 我可以在.NET 2.0应用程序中使用的.NET 3.5的功能是什么?

Edit: what I have in mind is Extension Methods, Linq, lambdas, object initializers, collection initializers and other compiler candy. 编辑:我想到的是扩展方法,Linq,lambda,对象初始化程序,集合初始化程序和其他编译器糖果。

With no external libraries you can use 没有外部库,您可以使用

  • Lambda expressions Lambda表达式
  • Object Initializers 对象初始化器
  • Collection Initializers 集合初始化器
  • Extension Methods 扩展方法
  • Autoproperties 自动属性

With the help of an external library like LINQBridge you can also use in memory LINQ queries. 借助LINQBridge这样的外部库,您还可以在内存中使用LINQ查询。

The main feature you cannot use are expression trees because they rely on fixes in the CLR which are not present in a vanilla 2.0 install 不能使用的主要功能是表达式树,因为它们依赖CLR中的修订,而这些修订在vanilla 2.0安装中不存在

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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