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

hakan Gülay
hakan Gülay
8,489 Points

bool isOnMap = map.OnMap(point);

I am so confused about this.

bool isOnMap = map.OnMap(point);

what is point doing here ? Can you please explain clearly ?

map.OnMap(point);

1 Answer

Kjetil Lorentzen
Kjetil Lorentzen
13,360 Points

Point is passed into the onMap method to check if the point is within the bounds of the Map. Point contains the X and Y properties which are used in the logical check towards the X and Y dimensions of the Map object.

OnMap returns true if Point.X <Map.X && Point.Y < Map.Y