Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGreg Lennox
Courses Plus Student 488 PointsWhy does this not work in Visual Studio 2013: public MapLocation Location => _path.GetLocationAt(_pathStep);
I have the Invader Class using the shortened version of the Location constructor as follows:
private readonly Path _path;
private int _pathStep = 0;
public MapLocation Location => _path.GetLocationAt(_pathStep);
This works in your Mono C# workspace but I cannot compile it in my Visual Studio 2013. I get 3 errors:
- ; expected
- Invalid token '(' in class, struct, or interface memeber declaration.
- Invalid token ')' in class, struct, or interface memeber declaration.
Why would I be getting this error?
1 Answer
Steven Parker
231,198 Points
I don't think the 2013 version of Visual Studio supports the C#6 syntax (using "=>
").
You'll need to stick with the "long form" until you upgrade.