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#

Liam Andersson
Liam Andersson
1,396 Points

C# error

What's the error, been sitting here 10-15 minutes without a solution

https://w.trhou.se/gv7r2x2xy1

Error: Game.cs(9,17): warning CS0219: The variable map' is assigned but its value is never used Map.cs(17,32): error CS1061: TypeTreehouseDefense.Point' does not contain a definition for X' and no extension methodX' of type `TreehouseDefense.Point' could be found. Are you missing an assembly reference?
Point.cs(3,8): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 1 warnings

1 Answer

Steven Parker
Steven Parker
231,122 Points

In point.cs, on lines 5 and 6 the variables "x" and "y" are declared, but these should be named "X" and "Y" instead (capital instead of lower case).

Then on lines 10 and 11, there should not be a "var" keyword in front of the assignments. Using "var" would create new variables limited to the scope of the constructor, but these lines are intended to give values to the previously declared variables.