您可以在面向 .NET 3.5 的代码中使用可选参数吗? [英] Can you use optional parameters in code targeting .NET 3.5?

查看:22
本文介绍了您可以在面向 .NET 3.5 的代码中使用可选参数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望编写一个使用 C# 4.0 的新可选参数功能的库,但我想将其定位到该框架的 3.5 版本.这可能吗?

I'm looking to write a library that uses the new optional parameters feature of C# 4.0, but I want to target it to the 3.5 version of the framework. Is this possible?

可选参数和扩展方法一样是语法糖吗?

Are optional parameters syntactic sugar in the same way that extension methods are?

推荐答案

使用 VS2010 RC,我能够创建一个使用 C# 中可选参数的 .NET 3.5 应用程序.

With VS2010 RC, I was able to create a .NET 3.5 application that uses optional parameters in C#.

是的,一切都与语法糖有关.

So yes, it's all about syntactic sugar.

这篇关于您可以在面向 .NET 3.5 的代码中使用可选参数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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