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 Object-Oriented Programming Object Initialization

Lucas Dickey
Lucas Dickey
190 Points

I am getting error CS0103 Map.cs (10,21) Map.cs (11,22)

I am getting error CS0103 Map.cs (10,21) Map.cs (11,22)

Steven Parker
Steven Parker
231,275 Points

We might be able to help if we can see the code along with the build environment. The best way to share it is to make a snapshot of your workspace and post the link to it here.

2 Answers

Steven Parker
Steven Parker
231,275 Points

That first link was for when you were using the workspace, it's only temporary. But the second one is the snapshot which persists. I was able to examine the issue with that one.

If you look at the entire error messages, they contain some descriptions which can be useful:

Map.cs(10,21): error CS0103: The name `width' does not exist in the current context                                            
Map.cs(11,22): error CS0103: The name `height' does not exist in the current context 

In this case "width" and "height" should be the names of the parameters of the function, but they don't exist because on line 8 it looks like they were accidentally given names starting with a capital letter. The capital letter names are already being used by the fields defined on lines 5 and 6, and all four must be available for lines 10 and 11 to perform the assignments.