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#

Izzatilla Karimov
Izzatilla Karimov
9,284 Points

Error CS1061:

When I run the Game.cs on console it gives me an error!

Map.cs(17,26): error CS1061: Type TreehouseDefense.Point' does not contain a definition forX' and no extension method X' of typeTreehouseDefense.Point' could be found. Are you missing an a ssembly reference?
Point.cs(3,11): (Location of the symbol related to previous error)
Point.cs(10,13): error CS0103: The name X' does not exist in the current context Point.cs(11,13): error CS0103: The nameY' does not exist in the current context
Compilation failed: 3 error(s), 0 warnings

And I have no idea what it is asking for.

Here is Map.cs

namespace TreehouseDefense {

class Map 
{
    public readonly int Width;
    public readonly int Height;

    public Map(int width, int height)
    {
        Width = width;
        Height = height;
    }

    public bool OnMap(Point point)
    {
        return point.X >= 0 && point.X < Width &&
               point.Y >= 0 && point.Y < Height;
    }
}

}

And heres Point.cs

namespace TreehouseDefense { class Point { public readonly int x; public readonly int y;

    public Point (int x, int y)
    {
        X = x;
        Y = y;
    }

}

}

Izzatilla Karimov
Izzatilla Karimov
9,284 Points

never mind I think i solved the problem it just had to be uppercase X,Y in Point.cs

public readonly int X; <<<< public readonly int Y; <<<<

1 Answer

Steven Parker
Steven Parker
231,236 Points

Those case-sensitive languages can be tricky! :smile: