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

后端 未结 7 934
独厮守ぢ
独厮守ぢ 2020-11-30 10:46

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?

7条回答
  •  甜味超标
    2020-11-30 11:35

    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.

提交回复
热议问题