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 trial

C# C# Objects Loops and Final Touches While Loops

Why 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:

  1. ; expected
  2. Invalid token '(' in class, struct, or interface memeber declaration.
  3. Invalid token ')' in class, struct, or interface memeber declaration.

Why would I be getting this error?

1 Answer

Steven Parker
Steven Parker
229,644 Points

:point_right: 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.