项目编译的.NET Framework 3.5的允许C#4.0的功能 [英] Project compiled against .NET Framework 3.5 allows C# 4.0 features

查看:592
本文介绍了项目编译的.NET Framework 3.5的允许C#4.0的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有一个项目,我的工作有.NET框架3.5的目标。我使用Visual Studio 2010;然而,我的同事使用Visual Studio 2008。我可以使用C#4.0的功能,如可选的功能参数,但如果他们试图用相同的目标建立在同一code,它们不能。这是我的理解是,即使我使用Visual Studio 2010中我将无法使用.NET 4.0的特性,因为目标是.NET 3.5。

I currently have a project I'm working on that has a target of .NET Framework 3.5. I am using Visual Studio 2010; however my coworkers use Visual Studio 2008. I am able to use C# 4.0 features such as optional function parameters, but if they try to build the same code with the same target, they are unable to. It was my understanding that even though I was using Visual Studio 2010 I would not be able to use .NET 4.0 features since the target was .NET 3.5.

推荐答案

默认情况下,多目标框架只限制的功能集,会导致兼容性问题与CLR(而不是源$ C ​​$ C)。因此,命名和可选的是合法的,因为使用它的2.0或3.5的CLR是没有问题的。

By default the multi-targeting framework only restricts the set of features that would cause compatibility issues with the CLR (not source code). Hence named and optional is legal because there is no issue using it on the 2.0 or 3.5 CLR.

  • 右键单击项目并选择属性
  • 转到建立标签
  • 单击高级按钮
  • 切换语言版本的组合为C#3.0

这篇关于项目编译的.NET Framework 3.5的允许C#4.0的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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