I have a Xamarin Forms project that was originally created in VS 2017, and then we found out we needed to target Windows 8, so I'm working on getting the project up and running in VS 2015.
I initially tried just opening the 2017 project in 2015, and it seemed OK, but when building, I got errors on every single line that used the lambda syntax (=>
), both within accessors and within regular function references. The errors are garden-variety syntax errors; the compiler doesn't seem to recognize the operator at all. For example, get => _privateVal;
results in the error CS1043 { or ; expected
.
I figured that it was a problem with opening a 2017 project in 2015, so I created a new project from scratch in 2015, but I have the same problem.
I don't have a lot of .NET experience, but lambdas have been around for a long time, so I don't know why a two-year old version of Visual Studio would have such a problem. I'm guessing it might be a build target problem (similar to Visual Studio 2008 doesn't recognize Lambda Expression Syntax) but if that's it, I really don't know how to correct it.
In summary, can anyone explain why C# doesn't recognize lambda syntax and have thoughts on how it can be fixed?