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 Methods Return Values

Josh Lee
Josh Lee
4,707 Points

compiler error. Point.cs(9,9): error CS1525: unexpected Symbol

I keep getting Complier errors. Im looking at the Point.cs file and everything seems to be correct:

namespace TreehouseDefense { class Point { public readonly int X; public readonly int Y; }

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

Compiler Errors: Point.cs(9,9): error CS1525: Unexpected symbol Point', expectingclass', delegate',enum', interface',partial', or struct' Point.cs(11,4): error CS1525: Unexpected symbolX', expecting class',delegate', enum',interface', partial', orstruct'
Point.cs(13,3): error CS1514: Unexpected symbol }', expecting.' or `{'
Compilation failed: 3 error(s), 0 warnings

What could i be doing wrong?

2 Answers

I believe you are missing a } to close off your namespace.

I think your constructor must be inside the class i.e remove the curly brace after you declare Int readonly Y and place it in between the last curly braces