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 Magic Numbers and Constants

my code is failing to compile and i cant find whats wrong

https://w.trhou.se/xjok6b99l4 what am i missing...someone help1

3 Answers

Steven Parker
Steven Parker
229,771 Points

That fresh snapshot is much better!

So there's currently only one version of "DistanceTo", and it takes 2 arguments. But you're calling it in MapLocation.cs with just one. Now it could be that you're in the middle of some changes and the course is about to have you make another version of "DistanceTo" that will work with the one argument.

But in case that's not it, or if you just want to make it compile anyway, you can convert the MapLocation object into separate X and Y values like this:

            return DistanceTo(location.X, location.Y) <= range;

thanks steven,it compiled.........u the best!

Steven Parker
Steven Parker
229,771 Points

That's the same workspace I looked at for you last Thursday, where it turned out there was a stray semicolon, remember? You said you removed the semicolon and it worked.

Are you having a different issue now? You'll need to make a fresh snapshot and post the link to that one.

yes ,last week i removed the semi colon and it worked,however this time its a different problem,when i compile this it says No overload for method DistanceTo' takes1' arguments https://w.trhou.se/jdvhc1u21r

Steven Parker
Steven Parker
229,771 Points

That's still the same link to the old snapshot. A snapshot "freezes" the state of your workspace at the moment you make it. To show your current issue, you'll need to make a fresh snapshot and share that new link.

https://w.trhou.se/xjok6b99l4 thats my current workspace