How to upgrade C # version in VS 2015?

I have a solution that has been refactored from C # 6.0 to C # 5.0. What parameters should be changed in VS 2015 to verify that using the syntax features of C # 6.0 is not in my solution? Can I do it another way?

+6
source share
2 answers

Project-> Properties-> Build-> Advanced-> Language Version

+13
source

You can include this for each project.

In the project properties, go to "Build", then "Advanced", then select the C # language version.

These settings are not perfect. That is, this may prevent you from using certain C # functions, but it will not disable some changes in the compiler.

For example, C # 6 introduced improved overload resolution. This one remains on regardless of which language version is selected in the project. This means that you can write code in VS 2015 that does not compile in VS 2013, even if the language version is forcibly linked to C # 5.

If you intend to use this so that you can guarantee that your code will continue to compile with the true C # 5 compiler, then you cannot do it, however, overload resolution remains small angular.

+4
source

All Articles