可.NET已经安装了NET 2.0运行在计算机上运行的应用程序3.5? [英] Can .Net 3.5 apps run on machines that have .Net 2.0 runtime installed?

查看:192
本文介绍了可.NET已经安装了NET 2.0运行在计算机上运行的应用程序3.5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写我在VS 2008中的应用程序,因此使用所有的幻想的东西,如LINQ,对象初始化等。现在我可以上只有NET 2.0运行时,但没有净3.5运行时机器的应用程序运行? .NET 3.5运行时是一个巨大的下载,因为所有你可能知道。

I write my app in VS 2008 and so use all the fanciful stuffs such as LINQ, object initializers etc. Now can my app run on machines that have only .Net 2.0 runtime, but no .Net 3.5 runtime? .Net 3.5 runtime is a huge download, as all of you might know.

推荐答案

有什么可以用的是例如无功的关键字,自动吸气和经销商的制定者,对象初始化。即被编译为2.0 code语法糖。

What you can use is for example the var keyword, auto-getters and auto-setters, object initializers. I.e. syntactic sugar that is compiled to 2.0 code.

你有什么不能用的是驻留在Net框架3.0和3.5库功能。例如LINQ。

What you can't use is functionality that resides in .Net framework 3.0 and 3.5 library. For example LINQ.

您可以尝试自己,你能和不能在Visual Studio中设置的目标平台,.net Framework 2.0的使用的。当您从框架3.0和3.5使用的东西,编译器会抱怨。

You can try for yourself what you can and can't use by setting target platform in Visual Studio to .Net Framework 2.0. The compiler will complain when you use things from Framework 3.0 and 3.5.

您可以使用扩展方法有一个小窍门:创建这个类到你的项目

You can use Extension Methods with a little trick: Creating this class to your project

namespace System.Runtime.CompilerServices
{
    public class ExtensionAttribute : Attribute { }
}

扩展方法实际上还编到2.0 code,但编译器需要这个类来定义。阅读关于它这里

这篇关于可.NET已经安装了NET 2.0运行在计算机上运行的应用程序3.5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆