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
177,955 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
177,955 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.