Alex Rivera | Logout

Can you use optional parameters in code targeting .NET 3.5?

Asked 2009-07-31T04:25:37.513
32

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?

Edit
Report

2 Answers

5

Like Jon Skeet I was getting "Feature 'optional parameter' cannot be used because it is not part of the 3.0 C# language specification". However in the RTM version of Visual Studio you can select Language Version to "default" in Project Properties->Build->Advanced. That got it to work for me.

answered 2010-07-12T14:45:10.773
0

VB.NET has optional parameters if you want to use optional parameters in .NET 3.5.

answered 2009-07-31T04:29:33.217

Your Answer